Skip to content

Instantly share code, notes, and snippets.

@staltz
staltz / introrx.md
Last active May 15, 2025 10:37
The introduction to Reactive Programming you've been missing
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 12, 2025 01:59
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@mikepugh
mikepugh / FirebaseStateSecurityManager
Last active December 16, 2016 12:09
StateSecurityManager - ui-router version of the RouteSecurityManager from angularFire-seed
/*
MIT License
ui-router Port of Firebase Simple Login RouteSecurityManager from
https://github.com/firebase/angularFire-seed/blob/master/app/js/module.routeSecurity.js
For any state that requires security, setup a custom data authRequired flag:
.state('profile', {
url: '/acct/profile',
templateUrl: 'views/account/profile.html',
@agendor
agendor / hapijs-rest-api-tutorial.md
Last active August 31, 2021 08:31
A practical introduction to building a RESTful API with the hapi.js server framework for Node.js
@pauldenotter
pauldenotter / plugin.js
Created February 27, 2014 23:31
Binding socket.io to a hapi.js plugin in node.js
var socketIO = require('socket.io'),
io;
// hapi plugin registration
exports.register = function(plugin, options, next) {
// this is the hapi specific binding
io = socketIO.listen(plugin.servers[0].listener);
io.sockets.on('connection', function(socket) {
socket.emit({msg: 'welcome'});
@blackfalcon
blackfalcon / git-feature-workflow.md
Last active May 3, 2025 02:39
Git basics - a general workflow

Git-workflow vs feature branching

When working with Git, there are two prevailing workflows are Git workflow and feature branches. IMHO, being more of a subscriber to continuous integration, I feel that the feature branch workflow is better suited, and the focus of this article.

If you are new to Git and Git-workflows, I suggest reading the atlassian.com Git Workflow article in addition to this as there is more detail there than presented here.

I admit, using Bash in the command line with the standard configuration leaves a bit to be desired when it comes to awareness of state. A tool that I suggest using follows these instructions on setting up GIT Bash autocompletion. This tool will assist you to better visualize the state of a branc

@ToJans
ToJans / InventoryItems.hs
Last active December 21, 2024 10:20
Haskell implementation of Greg Young's CQRS sample: https://github.com/gregoryyoung/m-r Love the sheer elegance of Haskell; no need for all that infrastructure crap
module InventoryItems(Command(..), Event(..), handle) where
import Data.Maybe(isJust)
type Id = String
type Name = String
type Amount = Int
data Command = CreateInventoryItem Id
| RenameInventoryItem Id Name
@sayotte
sayotte / Demo.txt
Last active April 26, 2016 16:10
Erlang inheritance in the gen_server model.
Eshell V5.9.1 (abort with ^G)
1> rr(parent).
[parent_type]
2> rr(child).
[child_type,parent_type]
3>
3>
3> {ok, P1} = child:start_link(none).
{ok,<0.42.0>}
4>
@parroty
parroty / quick.ex
Created October 27, 2013 13:23
Elixir QuickSort
defmodule QuickSort do
def sort([]), do: []
def sort([head|tail]) do
{lesser, greater} = Enum.partition(tail, &(&1 < head))
sort(lesser) ++ [head] ++ sort(greater)
end
end
IO.inspect QuickSort.sort([1,6,3,4,2,5])
@cgoldberg
cgoldberg / gource.sh
Created July 2, 2013 14:05
Gource - Mir development video
# install bzr and gource
# get a branch of Mir's trunk code
# create gource video
$ sudo apt-get install bzr gource
$ bzr branch lp:mir
$ cd mir
$ gource \
-s .06 \