This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Array < Object | |
puts 'Cool, “<” can be used to test class inheritance.' | |
end | |
if Object > Array | |
puts 'Cool, works the other way too.' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/net_http_debug.rb | |
if Rails.env.development? | |
require 'net/http' | |
Net::HTTP.class_eval do | |
class << self | |
attr_accessor :debug | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<style> | |
body { text-align: center } | |
h1 { font-size: 56px } | |
</style> | |
<link href="http://fonts.googleapis.com/css?family=Ruge+Boogie" rel="stylesheet"> | |
<script> | |
WebFontConfig = { google: { families: [ 'Butterfly+Kids::latin' ] } } | |
;(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raise FucktardError, 'You nuts?!?' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
codeMirror.setOption('onDragEvent', function(cm, e) { | |
// Move the cursor as they drag. | |
var pos = codeMirror.coordsChar({left: e.x, top: e.y }); | |
codeMirror.setCursor(pos); | |
codeMirror.focus(); | |
var isImageDrop = e.type == 'drop' && e.dataTransfer.files && e.dataTransfer.files.length > 0 && e.dataTransfer.files[0].type && e.dataTransfer.files[0].type.indexOf('image/') > -1; | |
if (!isImageDrop) return; | |
event.preventDefault(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ♫ A Little Reminder About JavaScript Boolean Evaluations ♫ | |
*/ | |
!!0 // false | |
!!NaN // false | |
!![] // true | |
!!new Array // true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ♫ Firefox-Proof Focus Styles ♫ | |
* | |
* Define your focus styles this way: a.focus { outline: 2px solid hotpink; } | |
* Only mini-tiny-pico quirk is a slight delay before the focus style appears. | |
* | |
* https://gist.github.com/536465 | |
*/ | |
$('a').bind({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.$().animate({ | |
scale: 1, | |
translateX: 0, | |
translateY: 0, | |
top: document.body.scrollTop, | |
left: 0, | |
width: window.innerWidth, | |
height: window.innerHeight |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var compressCSS = function(css) { | |
return css.trim() | |
.replace(/\s*([{}:;,>+~])\s*/g, '$1') // whitespace | |
.replace(/;}/g, '}') // trailing semicolons | |
.replace(/#(\w)\1(\w)\2(\w)\3\b/g, '#$1$2$3') // hex colors | |
.replace(/(\[[^=]+=)("|')([^"'\s]+)(\2)(\])/g, '$1$3$5') // useless attribute selector quotes | |
.replace(/\(('|")([^"'\s]+)(\1)\)/g, '($2)') // useless function quotes | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def gsub_array! find, replace | |
find.each_index do |i| | |
self.gsub! find[i], replace[i] | |
end | |
self | |
end | |
def gsub_array find, replace | |
str = self.clone |
OlderNewer