This file contains hidden or 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 express = require('express'), | |
request = require('request'); | |
var app = express(); | |
// Forward all requests from /api to http://foo.com/api | |
app.use('/api', function(req, res) { | |
req.pipe(request("http://foo.com/api" + req.url)).pipe(res); | |
}); |
This file contains hidden or 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
# New Year | |
59 23 31 12 * mplayer http://happy-year.narod.ru/mp3/kurant.mp3 | |
0 0 1 1 * mplayer http://media.kremlin.ru/1999_12_31_01s.mp3 | |
# Every morning - Chill Out (7:00 - 9:00) | |
0 7 * * 1-5 mplayer http://air2.radiorecord.ru/chil_320 | |
0 9 * * 1-5 pkill mplayer | |
# Every evening - Chill Out (19:00 - 22:00) | |
0 19 * * 1-5 mplayer http://air2.radiorecord.ru/chil_320 |
This file contains hidden or 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/sh | |
# /etc/init.d/phantomjs | |
case "$1" in | |
start) | |
phantomjs --webdriver=4444 & | |
;; | |
stop) | |
pkill phantomjs |
This file contains hidden or 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
[ | |
{ "key": "shift+cmd+backspace", "command": "editor.action.deleteLines", "when": "editorTextFocus" }, | |
{ "key": "cmd+d", "command": "editor.action.copyLinesDownAction", "when": "editorTextFocus" }, | |
{ "key": "shift+cmd+down", "command": "editor.action.moveLinesDownAction", "when": "editorTextFocus" }, | |
{ "key": "shift+cmd+up", "command": "editor.action.moveLinesUpAction", "when": "editorTextFocus" }, | |
{ "key": "cmd+shift+n", "command": "workbench.action.quickOpen" }, | |
{ "key": "cmd+1", "command": "workbench.view.explorer" }, | |
{ "key": "cmd+5", "command": "workbench.view.debug" } | |
] |
This file contains hidden or 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 | |
/** | |
* Get menu wildcard from path. | |
* | |
* @param $path | |
* The path, for example node/5/edit. | |
* | |
* @return | |
* Returns wildcard node/%node/edit. |
This file contains hidden or 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 my_create_a_node() { | |
global $user; | |
// entity_create replaces the procedural steps in the first example of | |
// creating a new object $node and setting its 'type' and uid property | |
$values = array( | |
'type' => 'YOUR_NODE_TYPE', | |
'uid' => $user->uid, | |
'status' => 1, |
This file contains hidden or 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 | |
# https://gist.github.com/mrded/17317466b3ebf71eb07a | |
require 'csv' | |
class MailChimpConverter | |
attr_accessor :columns | |
COLUMNS_HEADER = { |
This file contains hidden or 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 | |
// Insert into page callback. | |
drupal_add_html_head(array( | |
'#tag' => 'title', | |
'#value' => 'new header title', | |
), 'foo_title'); | |
drupal_add_html_head(array( | |
'#tag' => 'meta', | |
'#attributes' => array( |
This file contains hidden or 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
jobtypes = jobtypes.filter(function(item, pos, self) { | |
return self.indexOf(item) == pos; | |
}); |
This file contains hidden or 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
function httpGet(url, callback) { | |
var xmlHttp = new XMLHttpRequest(); | |
xmlHttp.onreadystatechange = function() { | |
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { | |
callback.call(this, JSON.parse(xmlHttp.responseText)); | |
} | |
}; | |
xmlHttp.open("GET", url, false); |