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
var animation = false, | |
animationstring = 'animation', | |
keyframeprefix = '', | |
domPrefixes = 'Webkit Moz O ms Khtml'.split(' '), | |
pfx = '', | |
elm = document.createElement('div'); | |
if( elm.style.animationName !== undefined ) { animation = true; } | |
if( animation === false ) { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Hello React</title> | |
<script src="https://fb.me/react-0.14.7.js"></script> | |
<script src="https://fb.me/react-dom-0.14.7.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script> | |
</head> | |
<body> |
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
Array.prototype.map = function (fun, thisArg) { | |
if(typeof fun !== 'function') { | |
throw new Error("The first argument must be of type function"); | |
} | |
var arr = []; | |
thisArg = (thisArg) ? thisArg : this; | |
thisArg.forEach(function(element) { | |
arr[arr.length] = fun.call(thisArgs, element); | |
}); |
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 addMinutes(date, minutes) { | |
return new Date(date.getTime() + minutes * 60000); | |
} | |
function getTimeRemaining(deadline) { | |
const t = Date.parse(deadline) - Date.parse(new Date()) | |
const seconds = Math.floor((t / 1000) % 60); | |
const minutes = Math.floor((t / 1000 / 60) % 60) |
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
let myPromise = new Promise((resolve,reject) => { | |
if( /* something is */ true ) { | |
resolve('Everything worked'); | |
} | |
else { | |
reject('Something went wrong'); | |
} | |
}); |
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 class MyJavaLinkedList { | |
public static MyLinkedList mylinkedlist; | |
public static void main (String[] args) { | |
mylinkedlist = new MyLinkedList(); | |
mylinkedlist.add(1); |
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 scala.concurrent.{ Await, Future } | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.duration.DurationInt | |
def f(n: Int): Future[Int] = Future(n + 1) | |
def g(n: Int): Future[Int] = Future(n - 1) | |
def h(n: Int): Future[Int] = Future(n * 2) | |
val n = f(42).flatMap(g) | |
assert(Await.result(n, 1.second) == 42) |
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
(() => | |
(() => 0 | |
)() | |
)() | |
//=> 0 |