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
/* | |
* anchor-include pattern for already-functional links that work as a client-side include | |
* Copyright 2011, Scott Jehl, scottjehl.com | |
* Dual licensed under the MIT | |
* Idea from Scott Gonzalez | |
* to use, place attributes on an already-functional anchor pointing to content | |
* that should either replace, or insert before or after that anchor | |
* after the page has loaded | |
* Replace: <a href="..." data-replace="articles/latest/fragment">Latest Articles</a> | |
* Before: <a href="..." data-before="articles/latest/fragment">Latest Articles</a> |
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
#! /bin/bash -e | |
SUPERVISORD=/usr/local/bin/supervisord | |
PIDFILE=/var/run/supervisord.pid | |
OPTS="-c /etc/supervisord/supervisord.conf" | |
test -x $SUPERVISORD || exit 0 | |
. /lib/lsb/init-functions |
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
#!/bin/bash | |
# | |
# Startup script for the Supervisor server | |
# | |
# Tested with Red Hat Enterprise Linux Server release 5.5 | |
# | |
# chkconfig: 2345 85 15 | |
# description: Supervisor is a client/server system that allows its users to \ | |
# monitor and control a number of processes on UNIX-like \ | |
# operating systems. |
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 | |
/* | |
The problem. | |
Input is a string—a paragraph of text. One of the paragraphs above would be fine. | |
Output is a report listing how many words there are with X letters, like: | |
10 words with 1 letter | |
20 words with 2 letters |
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
#!/bin/bash | |
# | |
# servicename Starts and stops a service | |
# | |
# chkconfig: 345 90 30 | |
# description: Example init script for older node.js application using spark | |
# | |
# processname: servicename | |
### BEGIN INIT INFO |
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
// suggested shell cmd line to run this: | |
// | |
// mongo --shell example2.js | |
// | |
// Note: the { out : … } parameter is for mongodb 1.8+ | |
db.things.insert( { _id : 1, tags : ['dog', 'cat'] } ); | |
db.things.insert( { _id : 2, tags : ['cat'] } ); | |
db.things.insert( { _id : 3, tags : ['mouse', 'cat', 'dog'] } ); | |
db.things.insert( { _id : 4, tags : [] } ); |
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
authRouteProvider.$inject = ['$routeProvider']; | |
function authRouteProvider ($routeProvider) { | |
/** | |
* Creates a controller bound to the route, or wraps the controller in param | |
* so the authentication check is run before the original controller is executed | |
* @param currentController | |
* @return {Function} The wrapper controller | |
*/ | |
function redirectCtrlFactory (currentController) { | |
_ctrl.$inject = ['currentUser__', 'userRole__', '$location']; |
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
# | |
# http://lists.grok.org.uk/pipermail/full-disclosure/2012-December/089076.html | |
# | |
use Net::MySQL; | |
$|=1; | |
my $mysql = Net::MySQL->new( | |
hostname => '192.168.2.3', |
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
db = db.getSisterDB("config"); | |
var mongosConn = db; // assume we connected to a mongos to get going | |
var res = null; | |
function check() { | |
printjson(res); | |
if( !res || !res.ok ) { | |
throw "check(): not ok, stopping"; |
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
require 'digest/md5' | |
def gfm(text) | |
# Extract pre blocks | |
extractions = {} | |
text.gsub!(%r{<pre>.*?</pre>}m) do |match| | |
md5 = Digest::MD5.hexdigest(match) | |
extractions[md5] = match | |
"{gfm-extraction-#{md5}}" | |
end |
OlderNewer