Skip to content

Instantly share code, notes, and snippets.

View lisp-ceo's full-sized avatar
🎯
Focusing

James Meldrum lisp-ceo

🎯
Focusing
View GitHub Profile
@lisp-ceo
lisp-ceo / README.md
Created March 14, 2019 15:12 — forked from roachhd/README.md
The Typeclassopedia from the Haskell wiki

% Typeclassopedia % Brent Yorgey

Originally published 12 March 2009 in issue 13 of the Monad.Reader. Ported to the Haskell wiki in November 2011 by Geheimdienst. Converted to Markdown in August 2013 by Erlend Hamberg. Converted to EPUB format with pandoc.

This is not the official version of the Typeclassopedia. The official version is now the Haskell wiki version which supersedes the version published in the Monad.Reader. Please help update and extend it by editing it yourself or by leaving comments, suggestions, and questions on the talk page.

Abstract

The standard Haskell libraries feature a number of type classes with algebraic or category-theoretic underpinnings. Becoming a fluent Haskell hacker requires intimate familiarity with them all, yet acquiring this f

@lisp-ceo
lisp-ceo / one-liners.md
Created June 17, 2016 10:00 — forked from KL-7/one-liners.md
Ruby one-liners

One-liners

Reverse every line:

Input file:

$ cat foo
qwe
123

bar

@lisp-ceo
lisp-ceo / Converting libraries to Ember CLI addons.md
Created February 5, 2016 09:37 — forked from kristianmandrup/Converting libraries to Ember CLI addons.md
Guide to Developing Addons and Blueprints for Ember CLI

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember library

The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.

@lisp-ceo
lisp-ceo / nginx.conf
Created January 6, 2016 00:52
Simple nginx lua script to add UUID to each request for end to end request tracking.
# Dependencies
# nginx_lua
# lua uuid module (luarocks install uuid)
http {
# this will be the request id
map $host $request_uuid {
default '';
}

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@lisp-ceo
lisp-ceo / search_canvas.cjsx
Created October 13, 2015 03:45 — forked from ConradIrwin/search_canvas.cjsx
Example canvas icon for canvas-animation-loader
d3 = require 'd3'
module.exports = class SearchIcon
# Construct an instance of a search icon.
# The animation will take {duration} milliseconds, and occupy
# a grid {width}x{height} pixels.
constructor: (duration, width, height) ->
if width != height
throw new ArgumentError("search icon was not rendered in a square")
--
-- how to populate locations table on db2 from wineries table on db1
--
-- SELECT "INSERT INTO locations( name, website, address, address2, city, state, zip, country, phone, created_at, updated_at, latitude, longitude, email, fax, winery_id ) VALUES (" || name ||", " || website || ", " || address || ", null , null, null, null, null, " || phone || ", " || created_at || ", " || modified_at || ",null, null, " || email || ", " || fax || ", " || winery_id || "); " FROM wineries
SELECT 'INSERT INTO locations( name, winery_id ) VALUES ("' || name || '", "' || winery_id || '"); ' FROM wineries

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

var cluster = require('cluster');
if (cluster.isWorker) {
console.log('Worker ' + process.pid + ' has started.');
// Send message to master process.
process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'})
// Receive messages from the master process.