This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Text afore gist</p> | |
<p data-gist-id="572406dce62dc51f8dfd392f3458e7e7" data-gist-hide-footer="true"> </p> | |
<p>Text after gist</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { //method from: https://community.canvaslms.com/thread/22500-mobile-javascript-development | |
// The following function will retrieve and load a JavaScript file - https://www.nczonline.net/blog/2009/07/28/the-best-way-to-load-external-javascript/ | |
function loadScript(url, callback) { | |
var script = document.createElement("script"); | |
script.type = "text/javascript"; | |
if (script.readyState) { //IE | |
script.onreadystatechange = function () { | |
if (script.readyState == "loaded" || script.readyState == "complete") { | |
script.onreadystatechange = null; | |
callback(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# by isn't needed | |
seq(from = 1, to = 10) # I could get the same result with seq(1, 10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* START - Styles for cards on Modules page */ | |
.ou-ModuleCard{ | |
box-sizing: border-box; | |
box-shadow: 0 2px 5px rgba(0,0,0,0.3); | |
border-radius: 6px; | |
overflow: hidden; | |
background: #fff; | |
width: 100%; | |
display: inline-block; | |
vertical-align: top; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Add tiles at top of modules tool: | |
* - Tiles are generated by calling the Canvas api, not by scraping the Modules page as before (should be more reliable as Canvas in upgraded) | |
* - Added a drop-down arrow which gives you a quick link to the Module item (page, discussion, etc) | |
* - Tiles will show any images put into a specific folder in the Course’s Files (this defaults to looking for a ’tiles’ folder). If no folder or too few images for the number of Modules, colours are used instead | |
* - Modules further down the page gain a coloured border to help tie things together | |
* - Clicking the tile anywhere except the drop-down arrow scrolls you down the Modules page to the appropriate Module. | |
* - I’ve added a Top button to each module which scrolls you back up to the dashboard view | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function update(Request $request, $id) | |
{ | |
$messages = [ | |
..., | |
'orcid.unique' => 'This ORCID ID is already in use in our database', | |
'orcid.regex' => 'The ORCID ID is in the format https://orcid.org/xxxx-xxxx-xxxx-xxxx', | |
..., | |
]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Rules; | |
use Illuminate\Contracts\Validation\Rule; | |
class Orcid implements Rule | |
{ | |
/** | |
* Create a new rule instance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div fxLayout="row" fxLayoutAlign='center top'> | |
<div fxFlex class="form-container"> | |
<h2>Edit your profile</h2> | |
<form [formGroup]="userForm"> | |
... | |
<mat-form-field class="full-width" appearance="outline"> | |
<mat-label>ORCID ID</mat-label> | |
<input id="orcid" matInput placeholder="https://orcid.org/xxxx-xxxx-xxxx-xxxx" formControlName="orcid"> | |
<mat-error *ngIf="orcid.errors?.pattern && (orcid.dirty || orcid.touched)">ORCID ids start with https://orcid.org/</mat-error> | |
<mat-error *ngIf="orcid.errors?.isORCID && (orcid.dirty || orcid.touched)">Please check your id carefully - see <a href="https://support.orcid.org/knowledgebase/articles/116780-structure-of-the-orcid-identifier" target="_blank">Structure of the ORCID Identifier</a></mat-error> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
import { isORCIDValidator } from '../../shared/index'; | |
@Component({ | |
selector: 'user-edit-component', | |
templateUrl: './user-edit.component.html', | |
styleUrls: ['./user-edit.component.css'] | |
}) | |
export class UserEditComponent implements OnInit { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms'; | |
/* | |
* Validator for 16 digit code which uniquely identifies an ORDCID id | |
* Digit 16 is a chceksum for digits 1-15 - this validator checks that | |
* Note: use other validators to check for valid Url which contains | |
* https://orcid.org | |
*/ | |
export function isORCIDValidator(control: AbstractControl): {[key: string]: any} | null { | |
if (control.value) { // don't check null values |
NewerOlder