Skip to content

Instantly share code, notes, and snippets.

View rharriso's full-sized avatar

Ross Harrison rharriso

View GitHub Profile
@rharriso
rharriso / Concept.js
Created June 6, 2012 06:50
Backbone.js: Handle multiple binds to the same model, with different contexts.
/*
Backbone event binding works very well. It is possible to remove listeners from specific context without specifying a named function
*/
//set up model
var Ork = Backbone.Model.extend({
defaults:{ says: "Waaaaaagh" }
});
var o = new Ork();
@rharriso
rharriso / MobileArtillery.m
Created August 24, 2012 21:44
kinda looks like NOD Mobile Artillery
[[[[UIAlertView alloc] initWithTitle:@"Alert Title"
message:"Message"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil, nil] autorelease] show];
@rharriso
rharriso / add_authors.rb
Created September 15, 2012 04:27
add authors to books, has and belongs to many bro
def add_authors
#set authors to those in the form
unless params[:authors].blank?
@book.authors.clear
@book.authors << Author.find(params[:authors])
@book.save
end
end
# model file
class SimpleModel extends Backbone.Model
# view file
class SimpleView extends Backbone.View
# click listener
onClick: ->
@model.trigger("selected")
# spec file
@rharriso
rharriso / .zshrc
Created June 29, 2013 19:42
Custom prompt display for Zsh. Shows current user, time, machine name, current directory, and current git branch (if applicable)
#
# prompt
#
alias ls='ls -G'
# Stuff for git
parse_git_branch () {
git branch 2> /dev/null | grep "*" | sed -e 's/* \(.*\)/ (\1)/g'
}
@rharriso
rharriso / add_copyright_exif.rb
Last active November 18, 2019 08:23
Paperclip processor for adding copyright info to uploaded files
@rharriso
rharriso / .ycm_extra_conf.py
Last active August 29, 2015 14:17
Adding lib headers to YouCompleteMe
#
# ...other config .....
#
# include all headers
for root, dirs, files in os.walk("./"):
if any("*.h" or "*.hpp" in files):
flags.append("-I")
flags.append(os.path.join(root))
@rharriso
rharriso / cengage_convert.rb
Created August 10, 2015 16:51
methods for converting to cengage filenames
require 'fileutils'
require 'securerandom'
#
# all files must match cengage file names
#
def cengagify_files folder_path
Dir.glob("#{folder_path}/**/*").each do |f|
# skip directories and simple names
next if File.directory?(f)
@rharriso
rharriso / copy-full-path.sh
Created November 5, 2015 19:22
Nautilus script to copy to clipboard on right click (using clipit)
#~/.local/share/nautilus/scripts/copy-full-path.sh
#! /bin/bash
echo $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS | clipit
@rharriso
rharriso / embed-robot.head.html
Created March 4, 2016 18:43
Embedding Font with many faces in Hype
<!-- How to embed Roboto locally -->
<!-- see instructions here: http://tumult.com/hype/documentation/2.0/fonts/ -->
<!-- download files from Google (google it) -->
<style>
/* base face */
@font-face {
font-family: 'Roboto', Arial, Helvetica;
src: url('${resourcesFolderName}/Roboto-Regular.ttf') format('truetype');