Skip to content

Instantly share code, notes, and snippets.

View zzarcon's full-sized avatar
🦍
Generating legacy code

Hector Zarco zzarcon

🦍
Generating legacy code
View GitHub Profile
@zzarcon
zzarcon / fibonacci_memoization.js
Created February 17, 2016 21:17
Javascript Fibonacci memoization
function fibonacci(num, memo) {
memo = memo || {};
if (memo[num]) return memo[num];
if (num <= 1) return 1;
return memo[num] = fibonacci(num - 1, memo) + fibonacci(num - 2, memo);
}
@zzarcon
zzarcon / demo.md
Created August 28, 2020 04:49
hehe

Title

@zzarcon
zzarcon / .bash_profile
Created March 3, 2015 20:59
Git terminal helper
### GIT
source ~/.bash/gitprompt.sh
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
alias gss="git status --short"
alias gl="git log --pretty=format:'%Cred%h%Creset - %C(green) %an %C(reset) - %C(yellow)%d%Creset %s %Cgreen(%cr) %Creset'"
@zzarcon
zzarcon / fibo_loop.js
Created February 26, 2016 18:22
Fibonacci loop
function fibonacci(num){
var a = 1, b = 0, temp;
while (num >= 0){
temp = a;
a = a + b;
b = temp;
num--;
}
@zzarcon
zzarcon / fibonacci.js
Created February 17, 2016 21:06
Javascript Fibonacci
function fibonacci(num) {
if (num <= 1) return 1;
return fibonacci(num - 1) + fibonacci(num - 2);
}
runWhen([{
changedFiles: () => Promise.resolve(['app/index.js', 'app/components/header.jsx']),
glob: ['app/components/**'],
task(paths) {}
}])
const subprocess = exec(command, {
env: {...process.env, FORCE_COLOR: true}
});
const subprocess = exec(command);
subprocess.stdout.pipe(process.stdout);
subprocess.stderr.pipe(process.stdout);
subprocess.on('exit', code => process.exit(code));
// Inline await to get the the user changed files
const filesToMatch = changedFiles ? await changedFiles() : files;
// Example of a test
test('should run command if glob files matches', async () => {
await modifyFixtures();
const {stdout} = await run(`'["__fixtures__/**"]' 'echo fixtures changed'`);
expect(stdout.trim()).toEqual('fixtures changed');
await restoreFixtures();
install:
- git clone https://github.com/$TRAVIS_REPO_SLUG.git $TRAVIS_REPO_SLUG
- cd $TRAVIS_REPO_SLUG
- git checkout -qf $TRAVIS_COMMIT