Skip to content

Instantly share code, notes, and snippets.

View blakek's full-sized avatar
☦️

Blake Knight blakek

☦️
View GitHub Profile
@isaacs
isaacs / comma-first-var.js
Created April 6, 2010 19:24
A better coding convention for lists and object literals in JavaScript
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
@mixonic
mixonic / server.js
Created April 28, 2011 22:49
Node.js + Socket.io + Bash. A collaborative terminal for your browser.
//
// This server will start a bash shell and expose it
// over socket.io to a browser. See ./term.html for the
// client side.
//
// You should probably:
//
// npm install socket.io
// curl -O https://github.com/LearnBoost/Socket.IO/raw/master/socket.io.min.js
//
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active July 20, 2024 05:10
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@jtdp
jtdp / gist:5443498
Last active May 23, 2024 16:23
Revert file permission changes in local git repository.. Very useful when you change permissions due to working on a samba share. Lifted from: http://stackoverflow.com/questions/2517339/git-how-to-recover-the-file-permissions-git-thinks-the-file-should-be
git diff -p \
| grep -E '^(diff|old mode|new mode)' \
| sed -e 's/^old/NEW/;s/^new/old/;s/^NEW/new/' \
| git apply
@branneman
branneman / better-nodejs-require-paths.md
Last active June 29, 2024 16:00
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@korayguclu
korayguclu / nginx.conf
Last active August 29, 2015 14:06 — forked from thoop/nginx.conf
nginx.conf from prerender.io to prerender angularjs for seo purposes
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change example.com (server_name and in the rewrite rule) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@stonehippo
stonehippo / app-prototyping-tools.md
Last active November 15, 2016 22:06
A collection of app prototyping tools that I find interesting

#App Prototyping Tools

Origami is a plugin for Apple's Quartz Composer visual development tool. Developed by Facebook for prototyping interaction design in mobile apps, Origami is well suited to that task.

Pros

  • Codeless, patches and wires interface
  • Create complex and very refined interaction prototypes quickly
@blakek
blakek / bash_aliases.sh
Last active January 31, 2020 18:09
My dotfile backup
##
# Standarize system commands
##
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -lhF'
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
@kirilloid
kirilloid / type.js
Last active July 29, 2022 19:42
getType
function getType (value) {
let type = typeof value;
if (type === 'object') {
return value ? Object.prototype.toString.call(value).slice(8, -1) : 'null';
}
return type;
}
[NaN, 0, 1, Infinity, // numbers
null, undefined, false, 'str', // other primitives
@mattradford
mattradford / pull-wpe.sh
Created April 27, 2018 15:49
Pull a WP Engine install via SSH. File and DB.
    #!/bin/bash
    # Pull an install's files and DB from WP Engine
    # Variables
    lpath='app/public/'
    rpath='~/sites/'$install
    #User input
    read -p 'Repo to clone (blank if none): ' repo
    read -p 'Install to pull: ' install
    read -r -p 'Include uploads? (y/N) ' response
    read -p 'Local MySQL port: ' port