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
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
// 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
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
{ | |
"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
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
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) |
OlderNewer