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
"So I was locked in out my PJs, no phone, keys, wallet, nothing... Luckily i had a light jacket on. My neighbors weren't home... and even if I could get online there isn't a company that manages my building it's just a dude who owns it. I couldn't log into Gmail to get my contacts because i have 2fa setup and my phone is in my apartment. It was a pretty great feeling. I just kinda walked around my place checking windows. Probably looked sketchy as shit. I decided to take the 1.5 mile walk downtown to find internet or somethign so I could google my landlords name or some shit. On my walk I passed 2 people who I asked if i could use their phone, one person laughed and said they only had a flip phone, the other turned out to be some insane lady and she legit barked at me. So i get downtown, go up to the office and no-one is here yet so the door is locked. I wait 20 minutes and noone shows up... I decide to walk down to this cafe where I know the owner. Lukily she is here and lets me use their POS system to googl |
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
defmodule FacePP do | |
use HTTPoison.Base | |
@expected_fields ~w( | |
api_key api_secret url mode attribute tag async | |
) | |
def process_url(url) do | |
"https://apius.faceplusplus.com" <> url | |
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
var Apple = function(selector, type) { | |
this.selector = selector; | |
this.type = type; | |
$(selector).click(this.onAppleClick.bind(this)); | |
}; | |
Apple.prototype = { | |
onAppleClick: function(evt) { | |
$apple = $(evt.currentTarget); |
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 jquerySpy = { | |
analytics: {}, | |
reset: function() { | |
this.analytics = {}; | |
}, | |
install: function(base) { | |
spyOn((base || window), '$').and.callFake(function(selector) { | |
var jquery_proxy = $(selector); |
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 analytics = {}; | |
spyOn(instance, '$').and.callFake(function(selector) { | |
var jquery_proxy = $(selector); | |
['show', 'hide', 'scrollTop'].forEach(function(method) { | |
jquery_proxy[method] = jasmine.createSpy().and.callFake(function() { | |
analytics[selector] = analytics[selector] || {}; | |
if(typeof analytics[selector][method] === 'undefined') analytics[selector][method] = 0; |
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
describe('init', function() { | |
[ // array of classes and methods to be called | |
['.item', 'onItemSelect'], | |
['.search', 'search'], | |
['.input', 'inputClicked'], | |
['.clear-item', 'clearItem'] | |
].forEach(function(item) { | |
it('binds ' + item[0] + ' click to the correct method', function() { | |
ComponentEngine.process(); |
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
renderProgress: function(percent) { | |
var rads = percent* 3.6 * Math.PI/180; | |
var $canvas = this.$('canvas'); | |
var canvas = this.$('canvas')[0]; | |
var offset = 5; | |
canvas.height = this.$().height() + offset*2; | |
canvas.width = this.$().width() + offset*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
for($i=0; $i<count($json->Search); $i++) { | |
$search = $json->Search[$i]; | |
$link = $json->{(string)$i}; | |
} | |
// OR | |
foreach($json->Search as $key=>$search) { | |
$link = $json->{(string)$key}; | |
} |
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
module ComponentHelper | |
def render_component(name, data={}) | |
erb_string = FileCache.read(Rails.root.join('app', 'components', name, "template.html.erb")) | |
view_context = ApplicationController.new.view_context | |
data.each do |key, value| | |
view_context.instance_variable_set("@#{key}".to_sym, value) | |
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
;(function($, Pusher) { | |
/* Resets all callbacks */ | |
Pusher.prototype.reset = function() { | |
$.each(this.channels.channels, function(name, channel) { | |
channel.callbacks._callbacks = {} | |
}) | |
} | |
$(document).on('pjax:send', function() { | |
$.each(Pusher.instances, function(index, instance) { |