Skip to content

Instantly share code, notes, and snippets.

Avatar

Ross Harrison rharriso

View GitHub Profile
@rharriso
rharriso / .ycm_extra_conf.py
Last active Aug 29, 2015
Adding lib headers to YouCompleteMe
View .ycm_extra_conf.py
#
# ...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 Aug 10, 2015
methods for converting to cengage filenames
View cengage_convert.rb
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 / Concept.js
Created Jun 6, 2012
Backbone.js: Handle multiple binds to the same model, with different contexts.
View Concept.js
/*
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 Aug 24, 2012
kinda looks like NOD Mobile Artillery
View MobileArtillery.m
[[[[UIAlertView alloc] initWithTitle:@"Alert Title"
message:"Message"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil, nil] autorelease] show];
@rharriso
rharriso / add_authors.rb
Created Sep 15, 2012
add authors to books, has and belongs to many bro
View add_authors.rb
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
@rharriso
rharriso / copy-full-path.sh
Created Nov 5, 2015
Nautilus script to copy to clipboard on right click (using clipit)
View copy-full-path.sh
#~/.local/share/nautilus/scripts/copy-full-path.sh
#! /bin/bash
echo $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS | clipit
View checking_events.coffee
# 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 Jun 29, 2013
Custom prompt display for Zsh. Shows current user, time, machine name, current directory, and current git branch (if applicable)
View .zshrc
#
# prompt
#
alias ls='ls -G'
# Stuff for git
parse_git_branch () {
git branch 2> /dev/null | grep "*" | sed -e 's/* \(.*\)/ (\1)/g'
}
@rharriso
rharriso / embed-robot.head.html
Created Mar 4, 2016
Embedding Font with many faces in Hype
View embed-robot.head.html
<!-- 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');
View gulptask-nodemon-newlinereplace.js
/*
server-start starts up nodemon
the output is corrected to show new lines correctly.
*/
var nodemon = require('gulp-nodemon');
var replace = require('stream-replace');
var gutil = require('gulp-util');
// Start server with nodemon