Skip to content

Instantly share code, notes, and snippets.

@jteneycke
jteneycke / company.rake
Created October 26, 2012 07:33 — forked from bartimaeus/company.rake
Part of my FatFreeCRM migration rake task. I've added custom fields and roles to this install of FatFreeCRM. The files used by this rake task are generated by another task that downloads them and converts then to csv files using the pipe "|" as the delimi
# Store rake tasks specific to [company]
namespace :[company] do
# Migrate [Company]'s data into the new CRM
namespace :migrate do
require 'progressbar'
desc "Run all [company] migration tasks"
task :all => [:config, :users, :comments, :accounts]
@jteneycke
jteneycke / newpost.rb
Created November 27, 2012 01:35 — forked from zanshin/newpost.rb
Ruby script to create new Octopress post, isolate it, and open it in an editor
#!/usr/bin/env ruby
#
# newpost.rb new-post-title
#
# Author: Mark Nichols, 8/2011
#
# This script automates the process of creating a new Octopress posting.
# 1. The Octopress rake new_post task is called passing in the posting name
# 2. The Octopress rake isolate taks is called to sequester all other postings in the _stash
# 3. The new file is opened in TextMate
@jteneycke
jteneycke / seesaw-repl-tutorial.clj
Created November 1, 2015 06:36 — forked from daveray/seesaw-repl-tutorial.clj
Seesaw REPL Tutorial
; A REPL-based, annotated Seesaw tutorial
; Please visit https://github.com/daveray/seesaw for more info
;
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers
; Seesaw's basic features and philosophy, but only scratches the surface
; of what's available. It only assumes knowledge of Clojure. No Swing or
; Java experience is needed.
;
; This material was first presented in a talk at @CraftsmanGuild in
; Ann Arbor, MI.
alias xclip='xclip -selection c'

Keyboard shortcuts

  • M-x nrepl-jack-in: Launch an nrepl server and a repl client. Prompts for a project root if given a prefix argument.
  • M-x nrepl: Connect to an already-running nrepl server.

While you're in clojure-mode, nrepl-jack-in is bound for convenience to C-c M-j and nrepl is bound to C-c M-c.

@jteneycke
jteneycke / gist:5268487
Created March 29, 2013 03:06
@function deparam Takes a string of name value pairs and returns a Object literal that represents those params. @param {String} params a string like <code>"foo=bar&person[age]=3"</code> @return {Object} A JavaScript Object that represents the params: { foo: "bar", person: { age: "3" } } https://github.com/jupiterjs/jquerymx/blob/master/lang/str…
function deparam(params) {
if (!params || !paramTest.test(params)) {
return {};
}
var data = {},
pairs = params.split('&'),
current;
// jQuery Deparam - v0.1.0 - 6/14/2011
// http://benalman.com/
// Copyright (c) 2011 Ben Alman; Licensed MIT, GPL
(function($) {
// Creating an internal undef value is safer than using undefined, in case it
// was ever overwritten.
var undef;
// A handy reference.
var decode = decodeURIComponent;
<script src="processing-1.4.1.js"></script>
<canvas data-processing-sources="codebase.pde hello-web.pde"></canvas>
for f in `find . -regex '.*\.html\.erb'`; do echo "Converting $f" && html2haml $f > "${f%.erb}.haml" && rm $f; done
@jteneycke
jteneycke / gist:5323379
Created April 5, 2013 23:06
Return every file in a directory that matches the html file type, even if it's missing it's extension.
for f in `find . -type f`; do file "$f"; done | grep "HTML document" | cut -d ":" -f 1