Skip to content

Instantly share code, notes, and snippets.

View sheenobu's full-sized avatar
🙃
smug

Sheena Artrip sheenobu

🙃
smug
View GitHub Profile
@bminer
bminer / changeTypeAttr.js
Created August 31, 2012 21:30
Cross-browser solution for changing the 'type' attribute of an `<input/>` tag.
/* x is the <input/> element
type is the type you want to change it to.
jQuery is required and assumed to be the "$" variable */
function changeType(x, type) {
if(x.prop('type') == type)
return x; //That was easy.
try {
return x.prop('type', type); //Stupid IE security will not allow this
} catch(e) {
//Try re-creating the element (yep... this sucks)
@chetanmeh
chetanmeh / logging-example.txt
Created August 19, 2012 13:38
Pax runner example demonstrating Logging
#This is a Pax Runner config file which uses Felix ConfigAdmin, Pax Logging and other bundles to
#demonstrate how to configure pax logging.
#It uses File install bundle and configures it to watch the config folder. We would add org.ops4j.pax.logging.cfg
#file to this folder which would then be picked by File install and thus update Pax logging config
--platform=felix
--vmOptions=-Dorg.osgi.service.http.port=9090 \
-Dfelix.fileinstall.dir=../config
#List of profiles to run
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@noomerikal
noomerikal / api.rb
Created February 20, 2012 06:55
kodagraph api
require 'sinatra'
require 'mongoid'
require 'json'
require 'jsonp'
require 'rack/throttle'
require 'dalli'
set :cache, Dalli::Client.new("localhost:11211")
set :short_ttl, 400
set :long_ttl, 4600
package my.elasticsearch;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@steadicat
steadicat / proxy.js
Created March 29, 2011 18:46
A reverse-proxy for CouchDB written in Node.js
#!/usr/local/bin/node
var sys = require('sys');
var http = require('http');
var url = require('url');
var PREFIX = '/db/';
var TARGET = 'http://example.cloudant.com';
var PORT = 8001;
@jpertino
jpertino / simpleJettyServer.groovy
Created January 20, 2011 04:29
a simple embedded jetty server
@Grab('org.mortbay.jetty:jetty-embedded:6.1.26')
import static org.mortbay.jetty.Handler.DEFAULT
import org.mortbay.jetty.Server
import org.mortbay.jetty.servlet.Context
import org.mortbay.jetty.servlet.DefaultServlet
import org.mortbay.servlet.MultiPartFilter
import groovy.servlet.GroovyServlet
import groovy.servlet.TemplateServlet
@danmackinlay
danmackinlay / supervisord.sh
Created August 27, 2009 07:07
an init.d script for supervisord
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.