Skip to content

Instantly share code, notes, and snippets.

@pheuter
pheuter / yo
Created September 9, 2017 04:24
0x94b830d74b649bbe82c44ba13201db4b63703f0f
0xcd480AcE2ab78C48131BE418eCad556EEC56741e
0x93DD32a66BCFF2ccBC6F95336cAc34c242857402
@pheuter
pheuter / gist:7d37a6f011c0aa786912
Created January 8, 2016 16:48
On why the team is moving forward with the ava test runner over mocha
mark
Jan 8, 2016
----
[11:45 AM]
yeah, and then i realized im thinking too much about it, and i went with the faster tool whose assertion syntax covers everything our tests use so far and is a relatively simple port over.
[11:46]
honestly, both tools are close, and i just picked one i feel can service us more with the bleeding edge environment we’re on
[11:46]
@pheuter
pheuter / gist:9b108bd425cd9d405308
Created August 13, 2014 18:52
Rick Ross image scraper using Nokogiri (鋸)
require 'open-uri'
require 'nokogiri'
i = 0
file = File.new "ross_image_urls.txt", "w"
50.times do
imageUrls = Nokogiri::HTML(open(URI.escape("https://www.google.com/search?q=rick+ross&biw=1301&bih=442&sei=WKvrU9nIJ43gsASAxYHQDQ&tbm=isch&ijn=2&ei=WKvrU9nIJ43gsASAxYHQDQ&start=#{i}"))).css('img').each do |image|
file.puts image['data-src']
end

Keybase proof

I hereby claim:

  • I am pheuter on github.
  • I am markfayngersh (https://keybase.io/markfayngersh) on keybase.
  • I have a public key whose fingerprint is 57E0 005D 96B5 5B63 C102 899A 6F7F 5E37 2A2F ED01

To claim this, I am signing this object:

class A
initialize: ->
@x = 1
a = new A
x: 1
log a
@pheuter
pheuter / test.js
Created November 21, 2012 19:32
backbone.computedfields marionette.collectionview unit test
describe('when ComputedFields initialized in Backbone.Model via Marionette.CollectionView', function () {
var model, collection, collectionView;
beforeEach(function () {
var Model = Backbone.Model.extend({
initialize: function () {
this.computedFields = new Backbone.ComputedFields(this);
},
@pheuter
pheuter / gist:3515945
Created August 29, 2012 17:33
Handlebars.js equality check in #if conditional

Handlebars.js is a template framework for Javascript environments. It allows the construction of HTML elements using HTML and expressions wrapped in {{ }}

Limitations of {{if}}

One of the conditional block helpers Handlebars offers is the {{#if}}.

For example:

<div class="entry">
@pheuter
pheuter / sc-dl.js
Created March 5, 2012 20:44
Bookmarklet that generates download link for a Soundcloud upload
(function(d) {
var dl = d.createElement('a');
dl.innerText = 'Download MP3';
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1];
dl.download = d.querySelector('em').innerText+".mp3";
d.querySelector('.primary').appendChild(dl);
dl.style.marginLeft = '10px';
dl.style.color = 'red';
dl.style.fontWeight = 700;
})(document);