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
// Create a Paper.js Path to draw a line into it: | |
var hexagon = new Path(); | |
// Color our path black | |
hexagon.strokeColor = 'black'; | |
// How many points do we want our object to have | |
var points = 6; | |
// How large should it be | |
var radius = 60; | |
// 0 to 2PI is a circle, so divide that by the number of points |
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
<!DOCTYPE html> | |
<html lang='en'> | |
<head> | |
<title>Hexagon</title> | |
</head> | |
<body> | |
<!-- Create a canvas and give it the attribute "resize" this tells Paper.js the canvas should be the size of the entire browser window --> | |
<canvas id='background-hexagons' resize></canvas> |
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
// Create a new hexagon with a radius of 100px at Point 200, 200 | |
var hexagon = new Path.RegularPolygon(new Point(200, 200), 6, 100); |
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? |
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
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
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
<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
# 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
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 |