Skip to content

Instantly share code, notes, and snippets.

Avatar
😏

Sam Seay samueljseay

😏
View GitHub Profile
@samueljseay
samueljseay / error
Created Nov 21, 2012
tutorial error
View error
1.9.3p327 :013 > pets = %w(rex nibbles fred)
=> ["rex", "nibbles", "fred"]
1.9.3p327 :014 > puts pets.map do |pet|
1.9.3p327 :015 > pet.upcase
1.9.3p327 :016?> end
#<Enumerator:0x007f9b4d02a4f0>
=> nil
1.9.3p327 :017 > puts pets.map(&:upcase)
REX
NIBBLES
@samueljseay
samueljseay / gist:7145313
Created Oct 24, 2013
Make your jQuery code play nice with Rails TurboLinks.
View gist:7145313
$(document).on("page:load",function(){
//do ALL THE THINGS :D
//see http://stackoverflow.com/questions/17386740/rails-4-turbolinks-and-jquery-dynamic-links-not-playing-nice
});
View haml_cheatsheet.haml
-# HTML5 doctype
!!! 5
!!! strict
!!! XML
%html
-#ie conditionals
/[if IE]
%a{ href: "http://www.mozilla.com/en-US/firefox/" }
@samueljseay
samueljseay / gist:7779276
Last active Jul 19, 2021 — forked from jimbojsb/gist:1630790
Color highlight and copy code for presentations
View gist:7779276

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@samueljseay
samueljseay / gist:13c2e69508563b2f0458
Last active Apr 7, 2016
Get real dimensions YUI
View gist:13c2e69508563b2f0458
function getRealDimensions(node) {
var clone,
result;
if ( ! node ) {
return false;
}
clone = node.cloneNode(true).show().setStyle('visibility','hidden').appendTo('body');
@samueljseay
samueljseay / css
Created Jul 9, 2014
Progress Animations with YUI transitions
View css
.progress-indicator {
position: absolute;
height: 40px;
overflow: hidden;
}
.progress-bubble {
background-color: #efefef;
width: 20px;
height: 20px;
View gist:5adc902e5ab6eec09370
// Don't do this
var RecentProblemsComponent = Y.Base.create('prb-recent-problems-component', Y.View, [Y.OHP.Component], {
initializer: function() {
this.goGetData().then(this.renderAThing);
},
renderAThing: function() {
//render part of my UI
this.nowFetchSomeOtherDataPls().then(this.renderOtherThings);
},
View gist:d765c0ec0d804522d42b
// You could do this
var RecentProblemsComponent = Y.Base.create('prb-recent-problems-component', Y.View, [Y.OHP.Component], {
initializer: function() {
this.goGetData().then(this.render);
},
render: function() {
if(this.hasSomeData) {
this.hideProgressIndicator();
this.showData;
@samueljseay
samueljseay / SassMeister-input-HTML.html
Created Mar 12, 2015
Generated by SassMeister.com.
View SassMeister-input-HTML.html
<div class='color'></div>
<div class='color-20'></div>
<div class='color-40'></div>
@samueljseay
samueljseay / SassMeister-input-HTML.html
Last active Aug 29, 2015
Generated by SassMeister.com.
View SassMeister-input-HTML.html
<div class='color'></div>
<div class='color-dark'></div>
<div class='color-darker'></div>