Skip to content

Instantly share code, notes, and snippets.

View simeonwillbanks's full-sized avatar
☀️
😎

Simeon Willbanks simeonwillbanks

☀️
😎
View GitHub Profile
@simeonwillbanks
simeonwillbanks / MacVim-Janus.md
Created October 12, 2011 22:51 — forked from jraines/MacVim-Janus.md
Readme: Macvim & Janus #readme

##Intro

Janus is a "basic distribution of vim plugins and tools intended to be run on top of the latest MacVIM snapshot." It is maintained by Yehuda Katz and Carl Lerche.

I recently whinged on Twitter that all I really want is vim with TextMate's Command-T go-to-file functionality and some efficient visual tab/buffer navigation. Turns out MacVim + Janus, with just a few tweaks, is all that and more.

Installing Janus

Follow the installation instructions on the git page

@simeonwillbanks
simeonwillbanks / fizzbuzz.js
Created October 31, 2011 19:05
#JavaScript #FizzBuzz #ProgrammingChallenge
(function(){for (var i = 1; i<=100; i++) { if (i % 3 == 0 && i % 5 == 0) {console.log("FizzBuzz");} else if (i % 3 == 0) {console.log("Fizz")} else if (i % 5 == 0) {console.log("Buzz");} else {console.log(i);} }})();
@simeonwillbanks
simeonwillbanks / gist:1335255
Last active September 27, 2015 21:38
#commandline One liners
$ ps -ef | grep resque | grep -v grep | awk '{ print $2 }' | xargs kill; echo '* stopped all resque workers.'
$ find . -name \*.rb| xargs grep -n "SLASH_PLACEHOLDER"
$ git log --author simeon --pretty=oneline | grep -v Merge > ~/git-log.txt
% wget --mirror -p --html-extension --convert-links http://www.acm.uiuc.edu/workshops/zsh/
@simeonwillbanks
simeonwillbanks / encapsulated_hash.rb
Created January 19, 2012 21:54
#Rails Params Hash Encapsulated #ruby #method_missing
class EncapsulatedHash
def initialize(h)
@encapsulated = ActiveSupport::HashWithIndifferentAccess.new
h.each_pair {|key, value| @encapsulated[key] = value }
end
def method_missing(m, *args, &block)
if @encapsulated.respond_to? m
@encapsulated.send(m, *args, &block)
@simeonwillbanks
simeonwillbanks / Gemfile
Created January 26, 2012 23:18
#gemfile rails 3, rspec-rails, capybara, capybara-webkit, headless in order to run request specs that can test javascript
source 'https://rubygems.org'
gem 'rails', '3.2.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
@simeonwillbanks
simeonwillbanks / console.rb
Last active October 1, 2015 14:38
Multibyte Testing: figure out the best way to handle 'ArgumentError: invalid byte sequence in UTF-8' exceptions
=> "Résumé"
>> invalid = str + "\xc3\x28" # add accent and ( which invalidates string, http://www.utf8-chartable.de/unicode-utf8-table.pl?utf8=string-literal&unicodeinhtml=hex
=> "Résumé\xC3("
>> str.is_utf8?
=> true
>> invalid.is_utf8?
=> false
>> result = invalid.force_encoding(Encoding::ASCII_8BIT).encode(Encoding::UTF_8, :invalid => :replace, :undef => :replace, :replace => '') # converting to ascii destroys valid utf8
=> "Rsum("
>> result.is_utf8?
@simeonwillbanks
simeonwillbanks / proof of concept.txt
Created May 26, 2012 04:27
taskmapper-redmine issue notes #Taskmapper #gem #redmine #OpenSource
http://www.hostedredmine.com/issues/67867
$ irb -r rubygems -r taskmapper -r /Users/simeon/Projects/taskmapper-redmine/lib/taskmapper-redmine
>> RedmineAPI.authenticate('http://www.hostedredmine.com/', '999e4b8688e8dba3eee9515548e203c5bea5f019')
=> "http://www.hostedredmine.com/"
>> issue = RedmineAPI::Issue.find(67867, :params => {:include => 'journals'})
=> #<RedmineAPI::Issue:0x007fa28c0a0808 ...
>> issue.journals[0].notes
=> "I've read through the introductory ns3 stuff and will be saving the Contiki documentation for next week."
>> issue.journals[1].notes
@simeonwillbanks
simeonwillbanks / utf8able.rb
Created June 8, 2012 17:31
Mixin Idea To Force UTF-8 #rails #ActiveRecord #utf8 #mixin
module Utf8able
extend ActiveSupport::Concern
included do
before_save do
# introspect attributes
# filter on text like
# force_utf8
end
end
// ==UserScript==
// @name GitHub delete all notifications button
// @namespace http://www.github.com/micolous/delete-all-notifications
// @description Adds a button to allow you to delete all notifications on a page.
// @include http://github.com/inbox/notifications*
// @include https://github.com/inbox/notifications*
// ==/UserScript==
/*
@simeonwillbanks
simeonwillbanks / 20120726165419UTC.rb
Created July 26, 2012 16:54
Testing 09a79f8dc3 #test
puts 'testing 1,2,3'