Skip to content

Instantly share code, notes, and snippets.

View nowk's full-sized avatar

Yung Hwa Kwon nowk

  • damncarousel
  • New York, NY
View GitHub Profile
@nowk
nowk / .ondirrc
Last active August 29, 2015 14:01
Poor mans .nvmrc and other preloaded requirements
# ~/.ondirrc
enter ~/Documents/(<your|folder|names|here)/([^/]+)
[[ -s $HOME/<pathtoyour>/ondirrc.sh ]] && . $HOME/<pathtoyour>/ondirrc.sh
fn(function(val) {
console.log(val);
}, function(val) {
console.log(val);
});
// foo
// bar
/* jshint node: true */
var i = 0;
var a = function b() {
i++;
// 3x
if (4 === i) {
return;
@nowk
nowk / Gruntfile.js
Created April 29, 2014 21:44
Simple grunt build
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
dist: {
files: [{
expand: true,
cwd: './',
src: ['index.js'],
dest: 'dist'
@nowk
nowk / for-loops.js
Last active August 29, 2015 14:00
for loops and the crazy i
/* jshint node: true */
var i = 0;
var len = 5;
for(; i<len; i++) {
// a => 0, 1, 2, 3, 4
setTimeout(a.bind(null, i));
/*
* grunt
* https://github.com/cowboy/grunt
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Copyright (c) 2012 John K. Paul @johnkpaul
* Licensed under the MIT license.
* http://benalman.com/about/license/
*/
@nowk
nowk / array_helpers.js
Last active August 29, 2015 13:59
Kata Array Helpers
/* jshint node: true */
var assert = require("chai").assert;
var origNumbers = [1, 2, 3, 4, 5];
var numbers = [1, 2, 3, 4, 5];
/*
* square each item in array
@nowk
nowk / functions.js
Created April 16, 2014 02:23
Javascript Function practice
/* jshint node: true */
var assert = require('assert');
/*
* named function
*/
function named() {
@nowk
nowk / closure.js
Created April 14, 2014 15:47
Javascript Closure practice
/* jshint node: true */
var assert = require("assert");
/*
* fn
*
* @return {Function}
*/
# add this file capybara_wait_until.rb to your /test directory
module Capybara
class Session
##
#
# Retry executing the block until a truthy result is returned or the timeout time is exceeded
#
# @param [Integer] timeout The amount of seconds to retry executing the given block
#