Skip to content

Instantly share code, notes, and snippets.

View RickCarlino's full-sized avatar
💾

Rick Carlino RickCarlino

💾
View GitHub Profile
@RickCarlino
RickCarlino / haml-watch.rb
Created September 21, 2012 15:47 — forked from gcorreaq/haml-watch.rb
Watch and compile all haml files on a directory, like sass --watch
#!/usr/bin/env ruby
# Script to watch a directory for any changes to a haml file
# and compile it.
#
# USAGE: ruby haml_watch.rb <directory_to_watch> [output_directory]
#
# Blake Smith / http://blakesmith.github.com/2010/09/05/haml-directory-watcher.html
#
require 'rubygems'
@RickCarlino
RickCarlino / inline coffee haml watcher.rb
Created September 21, 2012 15:49
inline coffeescript in HAML with :coffee and on-the-fly compilation
# inline coffeescript for haml with on-the-fly compilation
# run this script in the directory of your project
require 'fssm'
#required for using inline :coffee tag with HAML-
require 'coffee-filter'
directory = File.dirname(__FILE__)
FSSM.monitor(directory, '**/*') do
update do |base, relative|
@RickCarlino
RickCarlino / eartrainer.rb
Created November 29, 2012 14:40
Use the Lingq API to practice your foreign listening language skills
require 'rest_client'
require 'json'
#Initialization: Load the words into a usable format from the API.
#These are the only settings you would need to change if you were a different user:
#Goto: https://www.lingq.com/accounts/apikey/ to find your API Key
api_key = 'YOUR API KEY GOES HERE. CHANGE THIS!'
lang_code = 'ko' #for Korean, en for English, etc.
#The voice to use for your target language
@RickCarlino
RickCarlino / oops
Created December 13, 2012 09:18
Blah. I just vomited c++
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <map>
using namespace std;
ifstream readStream;
string tempString;
@RickCarlino
RickCarlino / for_josh.rb
Created January 27, 2013 13:18
Josh needed help debugging a Ruby script.
text = ' '
line_count = 0
File.open("text.txt").each do |line|
line_count += 1
text << line
end
puts "#{line_count} lines"
total_characters = text.length
puts "#{total_characters} characters"
total_characters_nospaces = text.gsub(/\s+/, ' ').length
@RickCarlino
RickCarlino / index.html
Created February 17, 2013 18:57
A CodePen by Rick.
<div class="container">
<h1>Hello</h1>
<p> <strong>Status:</strong><div class="status"> Not ready. </div></p>
<p> <strong>Note:</strong> Lorem epson dolorm epset.</p>
<div class="row">
<form>
<input class='input' name='waypoint' value='name'><br/>
<input class='input lat' name='lat' type='text' value='1'><br/>
<input class='input lng' name='lng' type='text' value='1'><br/>
</form>
@RickCarlino
RickCarlino / gist:5400949
Created April 17, 2013 00:59
A gist for my buddy Josh, who is learning the wonderful SinatraRB
require 'sinatra'
require 'shotgun'
get '/' do
# Did you put this in the '/views/' directory??
erb :form
end
post '/form' do
lines = params[:message]
class Something
constructor: ->
@delegateObject = new Messager
class Messager
testing: (int) ->
console.log int
woot: (bool) ->
console.log bool
nothing: (array) ->
@RickCarlino
RickCarlino / compass.coffee
Last active December 19, 2015 08:18
Cleaner interface to the HTML5 geolocation API
class Compass
constructor: (options = {enableHighAccuracy: yes, maximumAge: 10000, timeout: 100000}) ->
@lat = 0
@lng = 0
@alt = 0
@acc = 0
@altAcc = 0
@hdg = 0
@spd = 0
@_grabGPS(options)
encryption = (plain_text, key) ->
# Note: plain_text and key must be the same length
return if plain_text.length != > key.length
a = []
b = []
c = []
d = []
for char in w1