Skip to content

Instantly share code, notes, and snippets.

View damncabbage's full-sized avatar
🙅‍♀️
permanent omnishambles

Robin Howard damncabbage

🙅‍♀️
permanent omnishambles
View GitHub Profile
@juliocesar
juliocesar / gist:5997750
Last active December 19, 2015 18:19
Enabling caching in Sprockets
# Enables caching in Sprockets
# ============================
#
# I couldn't find it documented anywhere until I searched for it. Sprockets will recompile
# every file in a manifest for every request it serves if even *one* file in it changes,
# which it really slow for developing anything.
#
# This fixes that by ensuring only files that get changed get recompiled. NOTE: This is
# just an example. What you're looking for is in line 14.
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 7, 2024 01:27
A badass list of frontend development resources I collected over time.
require 'spec_helper'
require_dependency 'js_locale_helper'
describe JsLocaleHelper do
it 'should be able to generate traslations' do
JsLocaleHelper.output_locale('en').length.should > 0
end
def setup_message_format(format)
@ctx = V8::Context.new
@pyrmont
pyrmont / localist.php
Last active December 17, 2015 04:58
Initial version of a plugin to ease local development of WordPress websites.
<?php
/*
Plugin Name: Localist
Plugin URI:
Description: Localist allows you to reach an installation of WordPress regardless of the WordPress address defined in the database.
Version: 1.0
Author: Michael Camilleri
Author URI: http://inqk.net/
License: Public Domain
*/
@pyrmont
pyrmont / router.php
Created May 7, 2013 06:43
Routing file for PHP's built-in web server to work on WordPress (and serve PDFs).
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
chdir($root);
$path = '/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['path'],'/');
if(file_exists($root.$path)) {
if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/') {
@lengarvey
lengarvey / gist:5481777
Created April 29, 2013 14:08
Some vim hackery tonight led me to: https://github.com/benmills/vimux/pull/66
" open an IRB session in my current folder in the 20% tmux split below
map <Leader>irb :call VimuxRunCommand("clear;irb", 1, 0)<CR>
" Close the 20% tmux split below
map <Leader>cp :call VimuxCloseRunner()<CR>
" Open a shell in the 20% tmux split
map <Leader>sh :call VimuxRunCommand("clear", 1, 0)<CR>
@parndt
parndt / pre-commit
Last active December 16, 2015 11:59 — forked from ideasasylum/pre-commit
Place this in ~/.git_template/hooks/pre-commit and chmod to 755. Now, ensure you have git >= 1.7.1 and run: git config --global init.templatedir '~/.git_template' Back in your repository, run git init again and the hook will appear.
#!/usr/bin/env ruby
spec_hits = []
checks = {
'_spec\.rb$' => ['focus:[:space:]*true'],
'\.rb$' => ['binding\.pry', 'debugger']
}
# Find the names of all the filenames that have been (A)dded (C)opied or (M)odified
filenames = `git diff --cached --name-only --diff-filter=ACM`.split("\n")
@shanselman
shanselman / gist:5422230
Last active March 28, 2024 10:33
Evil Blog Comment Spammer just exposed his template through some error and the whole thing showed up in my comments.
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.|
#!/usr/bin/python -E
# -*- coding: UTF-8 -*-
# Usage: In ~/.tmuxrc,
# set default-command /Users/chirayu/ck/vcs/ck5/scripts/for_os_x/tmux_shell_with_clipboard_support.sh
import ctypes
import os
import platform
@benschwarz
benschwarz / csrf-token.js
Created April 7, 2013 23:11
Set the CSRF token for Rails when doing Ajax requests
define( ['jquery'], function ( $ ) {
var token = $( 'meta[name="csrf-token"]' ).attr( 'content' );
$.ajaxSetup( {
beforeSend: function ( xhr ) {
xhr.setRequestHeader( 'X-CSRF-Token', token );
}
});
return token;