Skip to content

Instantly share code, notes, and snippets.

View jjulian's full-sized avatar

Jonathan Julian jjulian

  • Ad Hoc LLC
  • MD
  • 18:21 (UTC -04:00)
View GitHub Profile
@jjulian
jjulian / Output iOS Icons.jsx
Last active August 29, 2015 14:28 — forked from tlinkner/Output iOS Icons.jsx
Photoshop script to output iOS icons, now with iOS 8 sizes
// Output iOS Icons.jsx
// 2014 Todd Linkner
// License: none (public domain)
// v1.2
//
// This script is for Photoshop CS6. It outputs iOS icons
// from a source 1024px x 1024px PSD
//
// bring Photoshop into focus
@jjulian
jjulian / opengem.bash
Created May 26, 2009 14:32
open a gem's src code in one shell command
# Inspired by Gembox
function opengem {
mate $GEMDIR/gems/`ls $GEMDIR/gems/|grep $1|sort|tail -1`/
}
_opengemcomplete() {
COMPREPLY=($(compgen -W '$(ls $GEMDIR/gems)' -- ${COMP_WORDS[COMP_CWORD]}))
return 0
}
complete -o default -o nospace -F _opengemcomplete opengem
@jjulian
jjulian / work
Created July 7, 2009 14:52
Use with 'rake time' to mark the beginning of your work day
# save to script/work in a rails project
# run it once, you will get an error 'script/work.tracker' did not match any file(s) known to git
# run git add script/work.tracker, and you are ready to go
# script/work at the beginning of the day to log a commit that says "I've begun working"
# use with the time tracker rake task: http://gist.github.com/141886
date "+%s" > script/work.tracker
git commit script/work.tracker -m "!!!starting work!!!"
desc "Check the JavaScript source with JSLint - exit with status 1 if any of the files fail."
task :jslint do
failed_files = []
classpath = File.join(RAILS_ROOT, "vendor", "rhino.jar")
jslint_path = File.join(RAILS_ROOT, "vendor", "jslint.js")
Dir['public/**/*.js'].reject{|path| path =~ /public\/ext\//}.each do |fname|
cmd = "java -cp #{classpath} org.mozilla.javascript.tools.shell.Main #{jslint_path} #{fname}"
results = %x{#{cmd}}
unless results =~ /^jslint: No problems found in/
puts "#{fname}:"
module WillPaginate
module ViewHelpers
alias_method :original_page_entries_info, :page_entries_info
def page_entries_info(collection, options = {})
"<div class=\"#{options[:class] || 'page_entries_info'}\">" + original_page_entries_info(collection, options) + '</div>'
end
end
end
require 'time'
#
# Compute the average time from a list of times.
#
# http://rubylearning.com/blog/2009/10/08/rpcfn-average-arrival-time-for-a-flight-2/
#
# ASSUMPTIONS
# * input error checking is left out. inputs are assumed to be in format h:m[am/pm], parsable by Time
#
/*
* Extends PanelRowExpander to show an edit panel in the expansion instead of an ExtTemplate.
*/
MyApp.MyRowExpander = function(config){
Ext.apply(this, config);
MyApp.MyRowExpander.superclass.constructor.call(this);
};
Ext.extend(MyApp.MyRowExpander, Ext.grid.PanelRowExpander, {
<%= javascript_include_tag 'jquery-1.3.2.js' %>
<% javascript_tag do %>
jQuery(function(){
window.onerror = function(msg, url, line) {
if (console && console.log) {
console.log("sending error: " + msg + "\n" + url + ":" + line);
}
$.post('/errors', {message: msg, url: url, line: line, form_authenticity_token: '<%= form_authenticity_token %>'});
return true;
};
# To rewrite server subdomains into directories: Capture the subdomains
# in a rewrite condition, then use backreferences to them in the rule.
# . run apache locally
# . add project.client.staging.domain.com to /etc/hosts
# . curl project.client.staging.domain.com
# . in rewrite_log, you'll see rewrite '/' -> '/root/staging/client/project'
RewriteLogLevel 3
RewriteLog "rewrite_log"
RewriteEngine On
ServerName project.client.staging.domain.com
var ourStore = new Ext.data.JsonStore({ //change to JsonStore
url:'Chapter15Example.json',
root:'files', //add root here
fields: [ //add fields here
{name:'file_name',mapping:'name'},
{name:'file_size',mapping:'size',type:'int'},
'type',
{name:'lastmod',mapping:'datelastmodified',type:'date'},
{name:'file_attributes',mapping:'attributes'}, //these last few fields are not in the source json
'mode',