This file contains 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
// let rec reverse p1 p2 = | |
// match p1 with | |
// [] -> p2 | |
// | n :: p1’ -> reverse p1’ (n :: p2) | |
function reverse(p1, p2=[]) { | |
if (!p1.length) { | |
return p2; | |
} | |
const [n, ..._p1] = p1; |
This file contains 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
class Task extends EventEmitter { | |
_innerResolve; | |
constructor() { | |
super(); | |
} | |
get running() { | |
return this._innerResolve !== undefined; |
This file contains 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
// Welcome! require() some modules from npm (like you were using browserify) | |
// and then hit Run Code to run your code on the right side. | |
// Modules get downloaded from browserify-cdn and bundled in your browser. | |
var getOrientedImage = require('exif-orientation-image'); | |
fileUpload = document.createElement('input'); | |
fileUpload.setAttribute('type', 'file'); | |
document.body.appendChild(fileUpload); | |
fileUpload.addEventListener('change',function(e) { | |
var file = e.target.files[0]; | |
getOrientedImage(file,function(err,canvas) { |
This file contains 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
gulp.task('release-js', ['build-js'], function (cb) { | |
pump([ | |
gulp.src(DEST + '/main.js'), | |
uglify(), | |
gulp.dest(DEST) | |
], cb); | |
}); | |
gulp.task('release-deps', ['deps'], function (cb) { | |
pump([ |
This file contains 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 StateProxy from "./state-proxy"; | |
const {params, dispatch, state} = this.props, | |
{organization, trip} = params; | |
// Proxy objects are light-weight & contain very little of own state. Just a mechanism for | |
// traversing a state tree. | |
// Only StateProxy instance holds reference to state tree. | |
// The idea is it would be created after memoized selectors are run in mapStateToProps() or render(). | |
let stateProxy = new StateProxy(dispatch, state), |
This file contains 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
"use strict"; | |
const fs = require('fs'), | |
path = require('path'); | |
const filestocopy = [ | |
{ | |
"res/android/drawable/logo.png": | |
"platforms/android/res/drawable-hdpi/logo.png" | |
} |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style> | |
#root { | |
height: 500px; | |
} |
This file contains 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 require_once __DIR__.'/../vendor/autoload.php'; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\HttpFoundation\File\UploadedFile; | |
use Silex\Application; | |
$app = new Application(); | |
$app['debug'] = true; |
This file contains 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
/** | |
* TODO: Need to add error handling and then submit pull request to 'blob-util' | |
* library. | |
*/ | |
export function objectURLToBlob(url) { | |
return new Promise((resolve, reject) => { | |
let xhr = new XMLHttpRequest(); | |
xhr.open('GET', url, true); | |
xhr.responseType = 'blob'; | |
xhr.onreadystatechange = () => { |
This file contains 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
// | |
// Actions | |
// | |
export const CONFIRM_MODAL_RESPONSE = "CONFIRM_MODAL_RESPONSE"; | |
export const SHOW_CONFIRM_MODAL = "SHOW_CONFIRM_MODAL"; | |
export function confirmDeleteItem(id) { | |
let message = `Are you sure you want to delete item: ${id}`, | |
context = {id}; | |
return showConfirmModal(message, 'confirmDeleteItem', context); |