Skip to content

Instantly share code, notes, and snippets.


Jason Rust jrust

View GitHub Profile
View hyper.js
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
// default font size in pixels for all tabs
fontSize: 13,
// font family with optional fallbacks
jrust / self.rb
Last active Dec 8, 2016
An interactive tutorial on the self, singleton class, and method hierarchy in ruby.
View self.rb
# Resources:
# Method lookup diagram:
# Seeing metaclasses clearly:
require 'rubygems'
require 'pry-debugger'
require 'awesome_print'
# Objects hold data, classes hold methods
# Just take a look at the source for Class
jrust / convert_thumbs.rb
Created Oct 17, 2012
Resize thumbnails on S3 #amazon #scripts
View convert_thumbs.rb
require 'rubygems'
require 'aws-sdk'
require 'mini_magick'
aws_access_key_id = 'access-key'
aws_secret_access_key = 'secret'
bucket_name = 'bucket'
s3 = :access_key_id => aws_access_key_id, :secret_access_key => aws_secret_access_key
jrust / copy_s3_bucket.rb
Created Aug 30, 2012
Copy one S3 bucket to another
View copy_s3_bucket.rb
require 'rubygems'
require 'aws-sdk'
aws_access_key_id = 'key-id'
aws_secret_access_key = 'access-key'
s3 = :access_key_id => aws_access_key_id, :secret_access_key => aws_secret_access_key
target_bucket = s3.buckets['old-bucket']
destination_bucket = s3.buckets['new-bucket']
jrust / README.markdown
Created Mar 13, 2012 — forked from pezholio/README.markdown
Bootstrap's Typeahead plugin extended (AJAX functionality, comma-separated values, autowidth, and autoselect)
View README.markdown

This is a fork of a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

  • Ability to disable autoselect of first matched element.
  • Ability to automatically set the width of the dropdown to that of the text input.
  • Ability to fetch source element via AJAX
  • Ability to have a comma separated list of tags.

For the proper source, and other examples, please see the original gist.

Example showing off all the above features

jrust / application.js
Created Jul 19, 2011
Binding events to both onload content and ajax-loaded content.
View application.js
var Application = {
// @see attach_behaviors();
behaviors: {},
init: function() {
$('body').bind('ajaxSuccess', Application.attach_behaviors);
jrust / gist:989391
Created May 24, 2011
Ruby & Rails & LP idioms
View gist:989391
# @method LpConfig
# @desc Set variables for use by javascript files
# @file taxonomies/views/index.html.erb
# Non-idiom
=begin erb code
<% javascript_tag do %>
$.post('<%= new_taxonomy_path %>');
<% end %>
jrust / gist:704391
Created Nov 17, 2010
Optimiser Audit Questions
View gist:704391
$content['type'] = array (
'name' => 'Optimiser Audit',
'type' => 'om_audit',
'description' => 'A web-based Optimiser audit.',
'title_label' => 'Please Enter a Description for This Audit',
'body_label' => '',
'min_word_count' => 0,
'help' => '',
'node_options' =>
array (
View google_spellchecker.rb
# Queries the Google spellcheck API to allow for determining misspelled words
# as well as providing corrective suggestions.
# Largely taken from the TinyMCE PHP Spellchecker plugin
module GoogleSpellchecker
require 'net/https'
require 'uri'
require 'builder'
def check_spelling(spell_check_text, lang='en')
You can’t perform that action at this time.