Skip to content

Instantly share code, notes, and snippets.

View oreillyross's full-sized avatar
🏠
Working from home

Faktor 10 oreillyross

🏠
Working from home
View GitHub Profile
@oreillyross
oreillyross / Test_CSS_animation_support.js
Created April 8, 2016 11:59
This code will check to see if CSS animation support is available: Query the animation boolean value
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 ) {
<form>
<fieldset>
<legend>
Application Form
</legend>
First Name: <input name="firstName" type="text" placeholder="Enter your first name" />
Last Name: <input name="lastName" type="text" placeholder="Enter your last name" />
Email Address: <input name="emailAddress" type="email" placeholder="Enter your e-mail address" />
</fieldset>
<input type="submit" value="Enroll" />
@oreillyross
oreillyross / React Basic Template.html
Created March 24, 2016 13:27
React example from the website
<!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>
@oreillyross
oreillyross / Javascript_Map_Impl.js
Created March 15, 2016 14:05
This is the javascript implementation of map
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);
});
@oreillyross
oreillyross / HTML5_tags.html
Created March 8, 2016 22:53
HTML5 Tags describing semantics
<template>
<header>
<nav>
<section>
<article>
<aside>
<figure>
<figcaption>
<footer>
<details>
let myPromise = new Promise((resolve,reject) => {
if( /* something is */ true ) {
resolve('Everything worked');
}
else {
reject('Something went wrong');
}
});
@oreillyross
oreillyross / MyJavaLinkedList.java
Created December 16, 2015 12:35
How To Implement a LinkedList Class From Scratch In Java
public class MyJavaLinkedList {
public static MyLinkedList mylinkedlist;
public static void main (String[] args) {
mylinkedlist = new MyLinkedList();
mylinkedlist.add(1);
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)