Skip to content

Instantly share code, notes, and snippets.

➜ ~ curl -L get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9248 100 9248 0 0 12208 0 --:--:-- --:--:-- --:--:-- 12208
Downloading RVM from wayneeseguin branch stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1023k 100 1023k 0 0 297k 0 0:00:03 0:00:03 --:--:-- 439k
Upgrading the RVM installation in /Users/admin/.rvm/
➜ / which rvm
rvm () {
typeset result current_result
export -a rvm_ruby_args > /dev/null 2> /dev/null
if (( ${rvm_ignore_rvmrc:=0} == 0 ))
then
: rvm_stored_umask:${rvm_stored_umask:=$(umask)}
for rvmrc in /etc/rvmrc "$HOME/.rvmrc"
do
if [[ -f "$rvmrc" ]]
/Users/bryceneal/Documents/rails/juiceyjuice/config/initializers/sorcery.rb:86:in `block in <top (required)>': undefined method `twitter' for Sorcery::Controller::Config:Module (NoMethodError)
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/sorcery-0.7.12/lib/sorcery/controller.rb:193:in `call'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/sorcery-0.7.12/lib/sorcery/controller.rb:193:in `configure!'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/sorcery-0.7.12/lib/sorcery/controller.rb:15:in `included'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/sorcery-0.7.12/lib/sorcery/engine.rb:11:in `include'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/sorcery-0.7.12/lib/sorcery/engine.rb:11:in `block in <class:Engine>'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/initi
@prettymuchbryce
prettymuchbryce / Dictionary.java
Created September 14, 2012 02:26
Dictionary with trie tree Java
//Dictionary implemented using a Trie Tree.
public class Dictionary {
private HashMap<Character,Node> roots = new HashMap<Character,Node>();
/**
* Search through the dictionary for a word.
* @param string The word to search for.
* @return Whether or not the word exists in the dictionary.
*/
public boolean search(String string) {
@prettymuchbryce
prettymuchbryce / gist:3719773
Created September 14, 2012 04:28
Dictionary with Trie Tree
class Node
attr_accessor :endOfWord, :children
def initialize()
@endOfWord = false
@children = {}
end
end
class Dictionary
@prettymuchbryce
prettymuchbryce / gist:3745462
Created September 18, 2012 19:56
Find minimum swaps to order a string of 0's and 1's
def findOperations(string)
operations = 0
list = string.split("")
startIndex = 0
endIndex = list.length-1
while startIndex < endIndex
if list[endIndex]=="0"
if list[startIndex] == "1"
list[startIndex], list[endIndex] = list[endIndex], list[startIndex]
operations = operations+1
@prettymuchbryce
prettymuchbryce / gist:3768553
Created September 23, 2012 02:08
Javascript Priority Queue Implementation
//Constants
PriorityQueue.MAX_HEAP = 0;
PriorityQueue.MIN_HEAP = 1;
/**
* This is an improved Priority Queue data type implementation that can be used to sort any object type.
* It uses a technique called a binary heap.
*
* For more on binary heaps see: http://en.wikipedia.org/wiki/Binary_heap
*
@prettymuchbryce
prettymuchbryce / gist:3783986
Created September 25, 2012 19:41
Ruby Quicksort
class QuickSort
def recurse(low, high)
i = low
j = high
pivot = @list[(low + (high-low)/2).floor]
while i <= j
while @list[i] < pivot
i+=1
def isPalindrome(value)
list = value.split("")
j = 0
i = list.length-1
while j <= i
if value[j] != value[i]
return false
end
j+=1
i-=1
require 'open-uri'
require 'ImageUtilities' #ImageUtilities is a module that is used to grab screenshots of a given URL. It is an external API.
require 'cgi'
require 'LatestCache' #LatestCache is a module that is used to update the cache for entries that have been submitted recently.
class EntriesController < ApplicationController
before_filter :authenticate, :only => "destroy" #User must have admin privileges to destroy an entry.
# This index method is hit via ajax call from javascript. It is the "HOT", or front page entries.
def index
page = params[:page] #Url Param can tell us which entry to start from. This is in the case that the user is scrolling down the page. Eatch "batch" of entries is a "page".