Skip to content

Instantly share code, notes, and snippets.

View mh120888's full-sized avatar

Matthew Higgins mh120888

View GitHub Profile
@mh120888
mh120888 / passing_spec.clj
Last active June 16, 2016 16:33
Testing console output in clojure 2
(describe "println"
(it "prints a line to the console"
(should= "This string is printed, not returned\n"
(with-out-str (println "This string is printed, not returned")))))
@mh120888
mh120888 / failing_spec.clj
Last active June 16, 2016 16:33
Testing console output in clojure
(describe "println"
(it "prints a line to the console"
(should= "This string is printed, not returned"
(println "This string is printed, not returned\n"))))
@mh120888
mh120888 / factoria.rb
Created June 6, 2016 22:42
Ruby Factorial Method
def factorial(n)
if n == 0
1
else
n * factorial(n-1)
end
end
@mh120888
mh120888 / factorial.clj
Last active June 6, 2016 22:45
Recursion in Closure
(defn factorial [n]
(loop [cnt n
acc 1]
(if (= cnt 1)
acc
(recur (dec cnt) (* acc cnt)))))
@mh120888
mh120888 / demo.css
Last active October 26, 2015 17:12
Ripple Button
body {
background-color: #FFF;
}
.btn {
display: inline-block;
text-decoration: none;
color: #FFF;
font-family: sans-serif;
background-color: #000;
@mh120888
mh120888 / README.md
Last active August 29, 2015 14:25
Sticky Nav Script Changes

#Sticky Nav Control Javascript I have three main goals in rewriting this script - improving performance, making it more easily extensible, and improving style (as in best practices and such, not adding colors).

##What does this script do? (same as before)

  • applies a height to our fixed masthead's container, preventing the rest of the page from appearing to slide up underneath the masthead
  • adds/removes a class, "shrink-nav", to navContainer based on how far a user has scrolled (can be leveraged to adjust the masthead)

##What doesn't it do? (changes)

  • no longer adds the "ready" class to the logo image or resizes the link that surrounds it
@mh120888
mh120888 / a.js
Last active August 29, 2015 14:24
value statement animation
$(document).ready(function() {
var $valueStatements = $('.value-statements li');
var statementSection = document.getElementsByClassName('value-statements')[0];
new Waypoint({
element: statementSection,
handler: function(direction) {
$valueStatements.velocity("transition.expandIn", { stagger: 225 });
this.destroy();
},
offset: "70%"
@mh120888
mh120888 / slide_animation.js
Created November 18, 2014 06:07
slide animation
$(window).ready(function() {
// grab all the slides
var slides = $('.slide');
var numOfSlides = slides.length;
// set the amount of time between slides, in milliseconds
var delayBetweenSlides = 2000;
// set the amount of time the animation takes, in milliseconds
var animationDuration = 1000;
// specify the styles for a non-visible slide
var transitionOut = {
@mh120888
mh120888 / attr_lazy.rb
Last active August 29, 2015 14:06
Kata
module AttrLazy
def attr_lazy(name, &block)
ruby_appropriate_name = "@#{name.to_s.gsub(/\?/, '')}"
define_method(name, set_instance_var_plus_block(ruby_appropriate_name, &block))
end
def set_instance_var_plus_block(name, &block)
Proc.new do
return self.instance_variable_get(name) if self.instance_variable_get(name)
self.instance_variable_set(name, self.instance_eval(&block))
@mh120888
mh120888 / 0.2.1-boggle_class_from_methods.rb
Last active December 27, 2015 23:09 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1 boggle class challenge
class BoggleBoard
def initialize(board)
@board = board
end
def create_word(*coords)
coords.map { |coord| @board[coord.first][coord.last]}.join("")
end