This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.defineProperty(Object.prototype, "extend", {value: function (obj) { | |
obj.__proto__ = this; | |
return obj; | |
}}); | |
Object.defineProperty(Object.prototype, "new", {value: function () { | |
var obj = Object.create(this); | |
if (obj.initialize) obj.initialize.apply(obj, arguments); | |
return obj; | |
}}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('select.jump_list').change(function() { | |
if (!this.value) { | |
return; | |
} | |
var url, url_len, last_char; | |
if (this.value.match('://')) { | |
window.top.location = this.value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MinSplPriorityQueue extends SplPriorityQueue | |
{ | |
public function compare($priority1, $priority2) | |
{ | |
if ($priority1 === $priority2) return 0; | |
return $priority1 > $priority2 ? -1 : 1; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'), | |
Url = require('url'), | |
htmlparser = require('node-htmlparser'), | |
dom = require('jsdom/level1/core').dom.level1.core, | |
index = require('jsdom/browser/index'), | |
sizzleInit = require('sizzle').sizzleInit; | |
// Simple wrapper around node's http client, htmlparser, jsdom, and sizzle | |
function fetch(url, callback) { | |
var uri = Url.parse(url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function apci_groups_user_is_groupmate($op, $user = NULL) { | |
switch ($op) { | |
case 'cache' : | |
// insert code here to return the cache_id name | |
if (arg(0) == 'user' && is_numeric(arg(1))) { | |
$uid = arg(1); | |
} | |
elseif (arg(0) == 'node' && is_numeric(arg(1))) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fcntl | |
import os | |
import struct | |
import subprocess | |
# Some constants used to ioctl the device file. I got them by a simple C | |
# program. | |
TUNSETIFF = 0x400454ca | |
TUNSETOWNER = TUNSETIFF + 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/custom/ree/bin/ruby | |
# USAGE: | |
# | |
# echo "|/path/to/core_helper.rb %p %s %u %g" > /proc/sys/kernel/core_pattern | |
# | |
require 'etc' | |
require 'net/smtp' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$0 = "master" | |
ARGV << "--rack" | |
ARGV << "--certname=#{File.read("/etc/puppet/certname").chomp}" | |
require 'puppet/application/master' | |
require 'base64' | |
require 'json' | |
require 'rack/utils' | |
require 'yaml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Creates iCalendar (ical) format output containing commits from a Git repo. | |
# Save as a file and import into Google Calendar or iCal on Mac. | |
# Publish on a webserver and link to Google Calendar directly. | |
# Install & Use: | |
# gem install grit icalendar | |
# chmod +x gitcal | |
# ./gitcal /path/to/repo > commits.ical |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fullred: #ff0000; | |
body { | |
font-family: Helvetica, Verdana | |
} | |
p { | |
padding: 7px 10px; | |
} | |
#demo { | |
border: 1px solid $fullred; | |
} |