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
input[type=checkbox] { | |
border: 1px solid #686868; | |
height: 27px; | |
width: 79px; | |
-webkit-appearance: none; | |
-webkit-border-radius: 13px; | |
background-image: url(/blog/wp-content/uploads/2011/12/checkbox-background.png); | |
background-position: -52px 0; | |
background-repeat: no-repeat; | |
-webkit-animation-timing-function: ease-in-out; |
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
GeoIP.new(File.join(Rails.root, 'db', 'localization', 'GeoLiteCity.dat')).city(request.remote_ip) | |
=> ["203.59.95.220", "203.59.95.220", "AU", "AUS", "Australia", "OC", "08", "Perth", "", -31.9333, 115.8333] | |
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 results = JSON.parse(response.responseText); | |
// Strip out the head node | |
var list = new WinJS.Binding.List(); | |
for (var i = 0, len = results.length; i < len; i++) { | |
list.push(results[i].company); | |
} | |
// This throws: JavaScript runtime error: Object doesn't support property or method 'createListBinding' | |
companiesList.winControl.itemDataSource = list; |
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 MyClass | |
def my_method(param) | |
puts "this is my method #{param}" | |
end | |
end | |
my_class = MyClass.new | |
x = my_class.method :my_method | |
x.("hello") |
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 el = document.getElementById('users'); | |
el.onchange = function() { | |
document.getElementById('cdm').innerHTML = el.values[el.selectedIndex]; | |
} |
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> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
var resize = function() { | |
$('altimg').each(function(i, e) { | |
if($(e).css('display') != "none") { | |
$('img[data-name=' + $(e).attr('data-name') + ']').attr('src', $(e).attr('src')).attr('alt', $(e).attr('alt')); |
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
# Allow the metal piece to run in isolation | |
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails) | |
class SpamDelay | |
def self.call(env) | |
@request = Rack::Request.new(env) | |
if env["PATH_INFO"] =~ /^\/contact/ | |
if env['REQUEST_METHOD'] == 'POST' | |
if @request.params['t'] && @request.params['t'].to_i < Time.now.gmtime.to_i - 2 |
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
document.domain = 'whatever.com'; |
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
gulp.task('build:javascripts', function(cb) { | |
webpack({ | |
entry: __dirname + '/app/frontend/javascripts/gifts.js', | |
output: { | |
path: __dirname + '/app/assets/javascripts', | |
filename: 'gifts.js' | |
}, | |
devtool: "#source-map", | |
module: { | |
loaders: [ |
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
def haversine(x, y) | |
r = 6371 | |
lat1 = x.latitude | |
lat2 = y.latitude | |
lon1 = x.longitude | |
lon2 = y.longitude | |
d_lat = (lat2 - lat1) * Math::PI / 180 | |
d_lon = (lon2 - lon1) * Math::PI / 180 | |