Skip to content

Instantly share code, notes, and snippets.

// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}
@jwalsh
jwalsh / api.js
Created August 15, 2011 20:35 — forked from aaronpowell/api.js
Q6 - What's old is new
var Person = function(name) {
this.name = name;
}
Person.prototype.sayHello = function() {
console.log('Hello, my name is ' + this.name);
}
(ns clojuredojo.core)
(defn palindrome-detector [thing] (= (reverse thing) (seq thing)) )
(def __ palindrome-detector)
(false? (__ '(1 2 3 4 5)))
(true? (__ "racecar"))
(true? (__ [:foo :bar :foo]))
(true? (__ '(1 1 3 3 1 1)))
@jwalsh
jwalsh / hack.sh
Created April 1, 2012 04:00 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
function makeRequest(url, method) {
var xhr;
if (typeof XMLHttpRequest === "undefined") {
return null;
}
xhr = new XMLHttpRequest();
if ("withCredentials" in xhr) {
xhr.open(method, url, true);
return xhr;
#!/bin/bash
# Make a static clone the working copy of a Jenkins build
# to a public directory for browser testing.
# Also cleans clones older than 14 days
#
# Parameters:
# $1: Publish target (absolute path, without "$1")
# $2: ID to use for the static clone directory
#
#!/bin/bash
# Make a static clone the working copy of a Jenkins build
# to a public directory for browser testing.
# Usage:
# From within the Jenkins working copy directory.
#
# version 3 (2012-06-07)
@jwalsh
jwalsh / gist:5086746
Last active December 14, 2015 12:29 — forked from palexander/gist:2975305
LIB=${HOME}/lib
BIN=${HOME}/bin
# Install Protocol Buffers
wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2
tar -xf protobuf-2.4.1.tar.bz2
cd protobuf-2.4.1
./configure --prefix=${HOME}
make
make install
@jwalsh
jwalsh / .eslintrc
Created September 6, 2016 20:22 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names