Skip to content

Instantly share code, notes, and snippets.

@nazgob
nazgob / hello_node.js
Created April 24, 2011 18:20
node.js echo request server
var http = require('http'),
sys = require('sys');
var server = http.createServer(function(request, response) {
request.addListener('end', function() {
response.writeHead(200, {
'Content-Type': 'text/plain'
});
response.write(sys.inspect(request));
response.end();
@tbjers
tbjers / bitly_filter.rb
Created August 15, 2012 17:53
Liquid Filter to convert URLs to short URLs automatically
require 'bitly'
module Jekyll
class BitlyFilterCache
def initialize
@result_cache = {}
config = Jekyll.configuration({})
@username = config['bitly']['username']
@key = config['bitly']['api_key']
Bitly.use_api_version_3
@saltcod
saltcod / gist:3761074
Created September 21, 2012 11:57
Intro to less
// global colour variables:
@blue = #3CF;
@red = #DF1F45
#content {
background: #eee;
padding: 25px;
// Jekyll Pygments syntax highlighter styles
// Color scheme
$base03: #002B36
$base02: #073642
$base01: #586E75
$base00: #657B83
$base0: #839496
$base1: #93A1A1
$base2: #EEE8D5
@ryanburnette
ryanburnette / remove-m-line-endings-from-dos-txt-file.vim
Created March 14, 2017 21:57
Remove ^M line endings from DOS text file.
:%s/\r//g
@tyabe
tyabe / better_errors_plugin.rb
Created December 16, 2012 14:09
This is Padrino Plugin for better_errors.
##
# Better Errors plugin on Padrino
#
# https://github.com/charliesome/better_errors
#
GEMFILE = <<-GEMFILE
# Better Errors
group :development do
@namusyaka
namusyaka / gist:8265452
Last active December 15, 2017 16:23
BetterErrors with Padrino 0.12
module Foobar
class App < Padrino::Application
enable :sessions
configure :development do
use BetterErrors::Middleware
BetterErrors.application_root = PADRINO_ROOT
set :protect_from_csrf, except: %r{/__better_errors/\d+/\w+\z}
end
....
@trey
trey / Gruntfile.js
Last active October 22, 2018 12:59
This is a braindump of the first time I was actually able to get Grunt to do all of what I wanted.
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
options: {},
}
},
@tomjn
tomjn / typekit.editor.php
Created September 10, 2012 10:22
Typekit fonts for TinyMCE editor plugin
add_filter("mce_external_plugins", "tomjn_mce_external_plugins");
function tomjn_mce_external_plugins($plugin_array){
$plugin_array['typekit'] = get_template_directory_uri().'/typekit.tinymce.js';
return $plugin_array;
}