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
// https://evilmartians.com/chronicles/html-best-practices-for-login-and-signup-forms | |
// A lot of good berst practices for login forms | |
// 10. Prevent forms from being sent twice | |
// Fix for Firefox. It persists the dynamic disabled state without this hack. | |
submitButton.autocomplete = 'off' |
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 logError(description, result, expectation) { | |
console.error('✖ ', description) | |
console.log('expected: ', expectation) | |
console.log('got: ', result) | |
} | |
function test(description, assertion, expectation) { | |
const result = assertion(); | |
result === expectation | |
? console.log('✔ ', description) |
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 newAnimationId = 0; | |
export function animateScrollTo(el, to, duration) { | |
const init = el.scrollTop; | |
const startTime = performance.now(); | |
let direction = to < init; | |
let change = 0; | |
if (direction) { |
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
{ | |
"Print object to console with label": { | |
"prefix": "cob", | |
"body": [ | |
"console.log(\"${1:this} = \", ${1:this});", | |
"$0" | |
], | |
"description": "Log object to console" | |
}, | |
"Print string to console": { |
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 executeOrRetry(retries, condition, fn, interval) { | |
if ((retries > 0) && condition()) { | |
setTimeout(() => { | |
executeOrRetry(retries--, condition, fn); | |
}, interval); | |
} else { | |
fn(); | |
} | |
} |
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
// string.js | |
export const capitalize = (string = '') => | |
(typeof string === 'string' && string.substring(1)) | |
? string[0].toUpperCase() + string.substring(1).toLowerCase() | |
: ''; | |
// string.test.js | |
import { capitalize } from './string'; | |
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
emailRegex = /^[\w-]+(\.[\w-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,20})$/i; |
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
sudo apt-get update | |
sudo apt-get upgrade | |
# 1) Download from source, the zip from the site has problems on linux | |
# https://github.com/cocos2d/cocos2d-x/pull/15958#issuecomment-228919359 | |
git clone https://github.com/cocos2d/cocos2d-x.git | |
cd cocos2d-x | |
# 2016-06-27 branch master is broken, change to commit 04d3550 | |
git checkout 04d3550 |
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
#!/usr/bin/env bash | |
# .git/hooks/pre-push | |
# hook to force tests and prevent failing pushs to develop or master | |
# | |
# Refs: | |
# http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks | |
# http://blog.ittybittyapps.com/blog/2013/09/03/git-pre-push/ | |
# | |
# Bypassing the pre-push hook: |
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
# https://gist.github.com/codexico/2a34c0d599f3af93b46f | |
[color] | |
# Use colors in Git commands that are capable of colored output when | |
# outputting to the terminal. (This is the default setting in Git ≥ 1.8.4.) | |
ui = auto | |
[color "branch"] |
NewerOlder