Skip to content

Instantly share code, notes, and snippets.

View dstroot's full-sized avatar
:octocat:
Slingin' Code

Dan Stroot dstroot

:octocat:
Slingin' Code
View GitHub Profile
@ngryman
ngryman / service.sh
Created October 4, 2012 16:50
Post: System V with forever for your node.js application
#! /bin/sh
### BEGIN INIT INFO
# Provides: your_application
# Required-Start: $remote_fs $network $syslog
# Required-Stop: $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: false
# Short-Description: your fancy description that no one will see ;)
@tonyseek
tonyseek / brew-cask-upgrade
Last active November 1, 2017 02:49
Upgrade all casks
#!/usr/bin/env bash
set -e
STAGING_LOCATION="$(brew cask doctor \
| grep -A1 '==> Homebrew-cask Staging Location:' | tail -n1 \
| awk '{print $1}')"
echo "==> Upgrading casks"
for cask in $(ls ${STAGING_LOCATION})
@dresende
dresende / ldapjs-addrbook.js
Created August 26, 2011 18:06
LDAP Addressbook using ldapjs
// MySQL test: (create on database 'abook' with username 'abook' and password 'abook')
//
// CREATE TABLE IF NOT EXISTS `users` (
// `id` int(5) unsigned NOT NULL AUTO_INCREMENT,
// `username` varchar(50) NOT NULL,
// `password` varchar(50) NOT NULL,
// PRIMARY KEY (`id`),
// KEY `username` (`username`)
// ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
// INSERT INTO `users` (`username`, `password`) VALUES
@jamesrr39
jamesrr39 / Go Pointers.md
Last active February 19, 2019 04:05
Go Pointers

Go pointers

This gist demonstrates the use of pointers in go (and other similar languages)

Use &x to get the address of x

Use *x to get a value from an address x

When should I use a pointer?

@abraithwaite
abraithwaite / config.go
Created March 15, 2017 03:03
Awesome way to do configuration in go. Taken from https://github.com/influxdata/telegraf
package main
import (
"io/ioutil"
"log"
"github.com/naoina/toml"
"github.com/naoina/toml/ast"
)
@jedschneider
jedschneider / gh-pages-tips.md
Created June 7, 2012 17:59
github pages tips for jekyll wiki

Working With Github Pages

The FAQ maintained by Github covers most stumbling blocks, some other tips and tricks supplied here.

Gitignore

Add _site to .gitignore. The generated site should not be uploaded to Github since its gets generated by github.

Working With Code Partials

@geddski
geddski / nesting.js
Created January 14, 2012 05:08
helper function for nesting backbone collections.
function nestCollection(model, attributeName, nestedCollection) {
//setup nested references
for (var i = 0; i < nestedCollection.length; i++) {
model.attributes[attributeName][i] = nestedCollection.at(i).attributes;
}
//create empty arrays if none
nestedCollection.bind('add', function (initiative) {
if (!model.get(attributeName)) {
model.attributes[attributeName] = [];
@ReesMorris
ReesMorris / csp-types.ts
Last active November 10, 2022 02:30
TypeScript Content Security Policy (CSP) Types
type Directive =
| 'child-src'
| 'connect-src'
| 'default-src'
| 'font-src'
| 'frame-src'
| 'img-src'
| 'manifest-src'
| 'media-src'
| 'object-src'
@chrissimpkins
chrissimpkins / gist:5bf5686bae86b8129bee
Last active March 6, 2023 00:10
Atom Editor Cheat Sheet: macOS

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
package main
import (
"fmt"
"log"
"net/http"
"html/template"
"github.com/gorilla/sessions"