Skip to content

Instantly share code, notes, and snippets.

View nchapman's full-sized avatar

Nick Chapman nchapman

View GitHub Profile
define(
[
"underscore",
"jquery",
"crc32"
],
function(_, $, crc32) {
"use strict";
/**
{
"sandboxes": [
{
"Name": "msgtype_counter",
"Outputs": [
{
"Filename": "data/msgtype_counter.MessageTypeCounts.cbuf",
"Name": "Message Type Counts"
},
{
@nchapman
nchapman / organizations_controller.rb
Created April 30, 2013 18:19
Less than beautiful generated controllers in Rails 4.
class OrganizationsController < ApplicationController
before_action :set_organization, only: [:show, :edit, :update, :destroy]
# GET /organizations
# GET /organizations.json
def index
@organizations = Organization.all
end
# GET /organizations/1
@nchapman
nchapman / hack.sh
Created April 27, 2013 05:01 — forked from erikh/hack.sh
#!/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
#
*filter
# Dropping incoming connections that don't have explicit rules below
:INPUT DROP [68:4456]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1628:151823]
# Allow localhost
-A INPUT -i lo -j ACCEPT

Dead-End Jobs: Are You Suffering From Stockholm Syndrome?

By Chad Fowler
Published: December 30, 2010

Have you heard of Stockholm Syndrome? It’s a name given to the condition wherein hostages develop positive feelings toward their captors despite being held in negative, unfavorable and even life-threatening conditions. Victims of Stockholm Syndrome will even inexplicably stay with their captors even when given the chance at freedom.

Hopefully nobody reading this is literally being held hostage right now. If you are, good luck!

For the rest of you, why might I suggest that you are suffering from Stockholm Syndrome? Because employment relationships can manifest themselves in this very way.

@nchapman
nchapman / setup.sh
Last active December 5, 2017 19:53
Ubuntu setup
# wget -O - https://raw.github.com/gist/4211882/<REVISION>/setup.sh | bash
# Get updates
apt-get -y update
apt-get -y upgrade
# Install build tools
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev curl git-core mysql-client libmysqlclient-dev libxslt-dev libxml2-dev python-software-properties
# Install Ruby
class OrganizationsController < ApplicationController
def index
@organizations = Organization.all
respond_with(@organizations)
end
def show
@organization = Organization.find(params[:id])
@nchapman
nchapman / gist:1862601
Created February 19, 2012 08:24 — forked from mudge/gist:1076046
CoffeeScript version of ActiveSupport's to_sentence method.
toSentence = (array = [], wordsConnector = ", ", twoWordsConnector = " and ", lastWordConnector = ", and ") ->
switch array.length
when 0 then ""
when 1 then array[0]
when 2 then array[0] + twoWordsConnector + array[1]
else array.slice(0, -1).join(wordsConnector) + lastWordConnector + array[array.length - 1]
@nchapman
nchapman / gist:1420115
Created December 1, 2011 21:44
Overflowing tables
<!DOCTYPE html>
<html>
<head>
<style>
table {
border: 1px solid #555;
table-layout: fixed;
width: 100%;
}