Instructions for setting up RVM on Mountain Lion
- Update to the latest XCode 4.4 from the App Store
- Install the Command Line Tools
| include_recipe "nginx" | |
| link "my_app" do | |
| to "my_app_directory" | |
| end | |
| nginx_site "my_app" |
| app = node[:rails][:app] | |
| rails_base app[:name] do | |
| ruby_ver app[:ruby_ver] | |
| gemset app[:gemset] | |
| end | |
| %w{config log pids cached-copy bundle system}.each do |dir| | |
| directory "#{app[:app_root]}/shared/#{dir}" do | |
| owner app[:deploy_user] |
| require 'sinatra' | |
| require 'oauth2' | |
| require 'rest_client' | |
| require 'json' | |
| get '/' do | |
| redirect client.auth_code.authorize_url(:redirect_uri => 'http://localhost:4567/callback', :state => 'your_api_is_crap') | |
| end | |
| get '/callback' do |
| # Converting Still Images to Video | |
| # ================================ | |
| # depends on ImageMagick and ffmpeg | |
| # | |
| mkdir temp | |
| cp *.jpg temp/. | |
| mogrify -resize 800x800 temp/*.jpg | |
| convert temp/*.jpg -delay 10 -morph 10 temp/%05d.jpg | |
| ffmpeg -r 25 -qscale 2 -i temp/%05d.jpg output.mp4 | |
| # rm -R temp |
| .data | |
| Graph: .word 0,1,1,0,0,1,1,0,0 | |
| .word 1,0,0,0,0,0,0,0,0 | |
| .word 1,0,0,0,0,0,0,0,0 | |
| .word 0,0,0,0,1,1,0,0,0 | |
| .word 0,0,0,1,0,1,1,0,0 | |
| .word 1,0,0,1,1,0,0,0,0 | |
| .word 1,0,0,0,1,0,0,0,0 | |
| .word 0,0,0,0,0,0,0,0,0 | |
| .word 0,0,0,0,0,0,0,0,0 |
| # Depth-first search (DFS) is an algorithm for traversing or | |
| # searching a tree, tree structure, or graph. One starts at | |
| # the root (selecting some node as the root in the graph case) | |
| # and explores as far as possible along each branch before backtracking. | |
| # | |
| # A graph can be represented by its adjacency matrix G, | |
| # where G[i][j] == 1 if there is an edge between | |
| # vertices i and j and 0 otherwise. | |
| # | |
| # Below Graph in diagram http://i.imgur.com/sV1UzUn.png |
| require 'open-uri' | |
| require 'nokogiri' | |
| # Scrapes wikipedia content for stack | |
| # The API blows, writing this was faster | |
| class WikiImporter | |
| # Words rejected will excluded from the results | |
| REJECT_WORDS = [ | |
| "Comparison of web application frameworks", |
| .data | |
| # Inputs | |
| FloatX: .float 134.0625 | |
| FloatY: .float 2.25 | |
| # Result | |
| Float_X_plus_Y: .float |
| a | |
| about | |
| above | |
| across | |
| after | |
| afterwards | |
| again | |
| against | |
| all | |
| almost |