Skip to content

Instantly share code, notes, and snippets.

View rockymadden's full-sized avatar
:octocat:
Setting status

Rocky Madden rockymadden

:octocat:
Setting status
  • UiPath
  • Pale Blue Dot
View GitHub Profile
@lsbardel
lsbardel / redis-server-for-init.d-startup
Created December 15, 2009 21:01 — forked from mtodd/redis-server-for-init.d-startup
Init.d Redis script for Ubuntu
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@retronym
retronym / type-bounds.scala
Created December 16, 2009 11:17
Tour of Scala Type Bounds
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed
@miikka
miikka / Simple.hs
Created August 24, 2010 19:07
Simple Haskell Twitter OAuth example
{-# LANGUAGE PackageImports #-}
{-
You need to register your Twitter application at <http://dev.twitter.com/>
to get the consumer key and secret needed for OAuth. When connecting to
Twitter for the first time, do this:
let consumer = Consumer "consumer key" "consumer secret"
token <- authenticate
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@pguillory
pguillory / gist:729616
Created December 5, 2010 23:51
Hooking into Node.js stdout
var util = require('util')
function hook_stdout(callback) {
var old_write = process.stdout.write
process.stdout.write = (function(write) {
return function(string, encoding, fd) {
write.apply(process.stdout, arguments)
callback(string, encoding, fd)
}
@SethTisue
SethTisue / ch19.scala
Created May 6, 2011 23:39
The Seasoned Schemer, chapter 19, page 176
// page 176
// recursive non-consing solution with var
def hasTwoInARow[T](lists: List[Any]) = {
var previous: Option[Any] = None
def recurse(rest: Any): Boolean =
rest match {
case xs: List[_] =>
xs.exists(recurse)
@jed
jed / LICENSE.txt
Created May 9, 2011 16:17 — forked from 140bytes/LICENSE.txt
communicate with jsonp
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@fwielstra
fwielstra / api.js
Created June 14, 2011 14:46
An example NodeJS / Mongoose / Express application based on their respective tutorials
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
@mjg123
mjg123 / ajax.cljs
Created July 21, 2011 22:43
How to make a json(p) request from ClojureScript using jQuery
(def jquery (js* "$"))
(defn show [msg]
(let [data-as-json ((js* "JSON.stringify") msg nil 4)]
((js* "alert") data-as-json)))
(defn make-js-map
"makes a javascript map from a clojure one"
[cljmap]
(let [out (js-obj)]