This file contains hidden or 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
// Show the event map | |
var $map = $('.location-map'); | |
if($map.length) { | |
var approx_location = $map.attr('approx-location'); | |
var approx_city = $map.attr('approx-city'); | |
var location = new google.maps.LatLng( | |
$map.data('latitude'), | |
$map.data('longitude') | |
); |
This file contains hidden or 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
require 'net/http' | |
Net::HTTP.start("example.com") do |http| | |
resp = http.get("/path/file.blah") | |
open("file.blah", "wb") do |file| | |
file.write(resp.body) | |
end | |
end |
This file contains hidden or 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 User < ActiveRecord::Base | |
after_create :notify_user_created | |
def notify_user_created | |
# Things happen in here | |
end | |
handle_asynchronously :notify_user_created | |
end |
This file contains hidden or 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 User < ActiveRecord::Base | |
after_create :notify_user_created | |
def notify_user_created | |
User.delay.async_notify_user_created(self.id) | |
end | |
def self.async_notify_user_created(id) | |
user = User.find(id) | |
user.do_the_think_you_were_going_to_do |
This file contains hidden or 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
# In API/V1/alerts_controller.rb | |
module Api | |
module V1 | |
class AlertsController < Api::V1::BaseController | |
... | |
end | |
end | |
end | |
# In API/V1/base_controller.rb |
This file contains hidden or 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
<script type="text/javascript" src="soundmanager/soundmanager2.js"></script> | |
<script type="text/javascript"> | |
soundManager.url = 'soundmanager/swf/'; | |
soundManager.flashVersion = 9; | |
soundManager.flash9Options.useWaveformData = true; | |
soundManager.debugMode = false; | |
</script> |
This file contains hidden or 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(typeof hyperlips.waveform == 'undefined') return false; | |
ctx.strokeStyle = 'rgba(255, 255, 255, 1)'; | |
ctx.lineWidth = 1; | |
ctx.lineJoin = 'round'; | |
ctx.beginPath(); | |
ctx.moveTo(0, canvas.height - 15); | |
for(var i = 0; i < hyperlips.waveform.points.length; i++) { | |
ctx.lineTo((canvas.width / hyperlips.waveform.points.length) * (i + 1), canvas.height - 15 + Math.ceil(hyperlips.waveform.points[i] * 10)); | |
} | |
ctx.stroke(); |
This file contains hidden or 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
soundManager.onready(function() { | |
hyperlips = soundManager.createSound({ | |
id: 'hyperlips', | |
url: 'cathode_girls.mp3', | |
autoPlay: true, | |
volume: 50, | |
whileplaying: function() { | |
this.waveform = {points: [], total: 0}; | |
var points = this.waveform.points; | |
for(var i = 0; i < 256; i++) { |
This file contains hidden or 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 page = require('webpage').create(); | |
// User-Agent is supported through page.settings | |
page.settings.userAgent = 'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25'; | |
// This is how you set other header variables | |
page.customHeaders = {'Referer': 'localhost'}; |
This file contains hidden or 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
// You wrote this line | |
Function.prototype.call(current[ev], this, arguments); | |
// This line does what I want, calling the method on the current tool and passing the arguments. | |
current[ev].apply(this, arguments); | |
// Not sure what you were aiming for with the other line? |