Skip to content

Instantly share code, notes, and snippets.

View eric-wood's full-sized avatar
🥑
probably snacking

Eric Wood eric-wood

🥑
probably snacking
View GitHub Profile
var stuff= jQuery('blockquote blockquote'); stuff.hide(); stuff.each(function() { var foo = jQuery(this); jQuery('<div class="quote-expand">expand</div>').prependTo(foo.parent()); }); jQuery('.quote-expand').click(function() { var stuffs = jQuery(event.target).parent().find('blockquote'); jQuery(stuffs[0]).is(':visible') ? stuffs.slideUp() : stuffs.slideDown() });
module SurveysToBeTaken
def survey_index
@today = Date.today.strftime("%m/%d/%Y")
# Take all surveys and only fetch current_users results. This also checks
map_survey_ids = Survey.pluck(:id)
user = params[:user_id].present? ? params[:user_id] : current_user.id
# search for files!
alias ff="ack --ruby --css --html --yaml --sass --js --scala --xml --shell"
# limit scope of search to directories that normally have the code we want :D
function f() {
ff "$@" app/ engines/;
}
@eric-wood
eric-wood / SassMeister-input.scss
Created June 4, 2014 16:07
Generated by SassMeister.com.
// ----
// Sass (v3.3.7)
// Compass (v1.0.0.alpha.18)
// ----
$class-slug: for;
@for $i from 1 through 4 {
.#{$class-slug}-#{$i} {
width: 60px + $i;
@eric-wood
eric-wood / SassMeister-input.scss
Created June 4, 2014 19:28
Generated by SassMeister.com.
// ----
// Sass (v3.3.7)
// Compass (v1.0.0.alpha.18)
// ----
$foo: "random";
.foo {
left: call($foo, 10);
}
@eric-wood
eric-wood / course_sniper.rb
Created June 17, 2014 14:30
Scan TAMU course catalog for open seats and notify user when one opens up
#!/usr/bin/env ruby
require 'uri'
require 'open-uri'
BASE_URI = "https://compass-ssb.tamu.edu/pls/PROD/bwykschd.p_disp_detail_sched?term_in=201431&crn_in="
# each course is represented by a CRN number
crns = %w[21179 12263 12265 12266 12267 12268 12271 21180]
@eric-wood
eric-wood / ack.sh
Created June 27, 2014 19:08
Spiceworks Community ack alias
alias ff="ag --ruby --css --html --sass --js --scala --shell --go "
function f() {
ff "$@" app/ engines/;
}
@eric-wood
eric-wood / search.sh
Created June 27, 2014 19:25
spiceworks community search
function f() {
types=( ruby css html sass js scala shell go )
for i in "${types[@]}"
do
ag --$i "$@" app/ engines/
done
}
require 'roomba/sensors'
class Roomba
include Sensors
# now I have the constants! yay!
end
# Direction can either be a Fixnum for number of degrees,
# or a symbol for the direction (:left, :right)
def rotate(direction, speed: DEFAULT_SPEED)
# handle symbols...
case direction
when :left
direction = -90
when :right
direction = 90
end