var INIT = 0x1 // 0 0 0 0 1
, PENDING = 0x2 // 0 0 0 1 0
, DONE = 0x4 // 0 0 1 0 0
, ERROR = 0x8 // 0 1 0 0 0
, SUCCESS = 0x10 // 1 0 0 0 0
, ALL = 0x1f // 1 1 1 1 1
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
;(function(){ | |
var text = [ | |
[ | |
"Right from the beginning, it appeared to us that designing the new" | |
, "When we first thought about it, we understood that designing the new" | |
] | |
, [ | |
" iPhone" | |
, " iMac" |
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
// ES6 tl;dr; for beginners | |
// 1. variables | |
// `const` & `let` are scoped at the block level | |
if(true) { | |
let foo = "bar" | |
} | |
foo // ReferenceError | |
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
function stripAccent( str ) { | |
var accents = "ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿñ" | |
, fixes = "aaaaaaceeeeiiiiooooouuuuyaaaaaaceeeeiiiioooooouuuuyyn" | |
, reg = new RegExp("(" + accents.split("").join("|") + ")", "g") | |
function replacement(a){ | |
return fixes[accents.indexOf(a)] || "" | |
} |
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
const store = createStore((state = { counter: 0 }, action) => { | |
switch(action.type) { | |
case "INCREMENT": | |
return { counter: state.counter + 1 } | |
case "DECREMENT": | |
return { counter: state.counter - 1 } | |
default: | |
return 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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>Welcome to my Website</title> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> | |
<script type="text/javascript" src="send.js"></script> | |
</head> | |
<body> | |
<h1>A Simple AJAX Contact Form</h1> | |
<form method="post" action="" id="contact_form"> |
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
function (destination, duration) { | |
// destination (relative to window top) in px | |
// duration in ms | |
/* Variables */ | |
var startPosition = "pageYOffset" in window ? window.pageYOffset : document.documentElement.scrollTop, | |
startTime = +new Date(), | |
endTime = startTime + duration, | |
// if top of element is outside the document, then define end point to document limit | |
// elsewhere, go the the top of the element | |
destinationSafe = document.height < (destination + window.innerHeight) ? document.height - window.innerHeight : destination, |
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
var DEFAULT_MAX_LISTENERS = 12 | |
function error(message, ...args){ | |
console.error.apply(console, [message].concat(args)) | |
console.trace() | |
} | |
class EventEmitter { | |
constructor(){ | |
this._maxListeners = DEFAULT_MAX_LISTENERS |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 Matthias Le Brun http://mlb.li | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
NewerOlder