Simple example of a promise in JavaScript. See "Javascript Promises explained"
<label for="amount">Post id:</label>
<input type="text" id="postId" value="1">
<button id="fetchPosts">Fetch post</button>
<div id="ajax-posts">
</div>
var forceRedraw = function(element){ | |
var disp = element.style.display; | |
element.style.display = 'none'; | |
var trick = element.offsetHeight; | |
element.style.display = disp; | |
}; |
function getCode() { | |
var pattern1 = /(?:http?s?:\/\/)?(?:www\.)?(?:vimeo\.com)\/?(.+)/g; | |
var pattern2 = /(?:http?s?:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=)?(.+)/g; | |
var regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/; | |
var video = "https://vimeo.com/58821159"; | |
if(pattern1.test(video)) { | |
var video_id = video.split('/'); | |
var id = video_id[video_id.length -1]; |
Simple example of a promise in JavaScript. See "Javascript Promises explained"
<label for="amount">Post id:</label>
<input type="text" id="postId" value="1">
<button id="fetchPosts">Fetch post</button>
<div id="ajax-posts">
</div>
I hereby claim:
To claim this, I am signing this object:
$sorted = $collection->sortBy(function ($element, $key) {
$timestamp = strtotime($element->date_field);
return $timestamp;
});
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Foundation\Application; | |
use Illuminate\Http\Request; | |
use Illuminate\Routing\Redirector; | |
use Illuminate\Support\Facades\App; | |
use Illuminate\Support\Facades\Config; | |
use Illuminate\Support\Facades\Session; |
Use Sublime Text’s Package Control (Preferences -> Package Control -> Install Package -> Phpcs
) to install the plugin.
In order for Phpcs to work, we need to install various command line tools.
function onFormSubmit(e) { | |
var fields = []; | |
for (i = 0; i < e.response.getItemResponses().length; i++) { | |
var response = e.response.getItemResponses()[i]; | |
fields.push({ | |
"name": response.getItem().getTitle(), | |
"value": response.getResponse(), | |
"inline": false | |
}); |
var moment = Moment.load(); | |
var GLOBAL = { | |
formId : "GOOGLE FORM ID", | |
calendarId : "GOOGLE CALENDAR ID", | |
formMap : { | |
eventTitle: "FORM FIELD TITLE NAME", | |
startTime : "FORM FIELD START TIME NAME", | |
description: "FORM FIELD DESCRIPTION NAME", | |