Skip to content

Instantly share code, notes, and snippets.

View alexanderscott's full-sized avatar

Alex Ehrnschwender alexanderscott

View GitHub Profile
@alexanderscott
alexanderscott / page-crawl.scala
Created September 6, 2014 05:28
Recursive page crawl using Scala & twitter-finagle
# Recursive page crawl using Scala & twitter-finagle
def crawl(url: String): Future[Seq[Resource]] =
fetch(url) flatMap { page =>
Future.collect(
page.links map { u => crawl(u) }
) map { pps => pps.flatten }
}
"use strict";
/**
* Grunt build & test helpers
*/
module.exports = function(grunt){
grunt.initConfig({
jsdoc: {
dist: {
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed.
*
* If you are unfamiliar with LESS, you can read more about it here:
* http://www.lesscss.org
*/
let g:spotify_track_search_url = "http://ws.spotify.com/search/1/track.json?q="
function! OpenUri(uri)
exec "silent !explorer " . a:uri
endfunction
function! OpenLine()
let uri = b:uris[line(".")-2]
call OpenUri(uri)
endfunction
@alexanderscott
alexanderscott / js-object-utils
Created February 27, 2014 17:48
JS Object Utils
"use strict";
var _und = require('underscore');
var ObjectUtils = {};
/**
* Find and return an Object's keys which have the greatest values
* @param {Object} hash - values are integers or floats
* @returns {Array} - array of strings (keys)
@alexanderscott
alexanderscott / introspection.rb
Created September 1, 2013 04:31 — forked from acook/introspection.rb
ruby introspection class
#
# You can do `Object.send :include, Introspection`
# Then you can call `.introspect` on anything.
#
# The `introspect` method returns a hash with information about the receiver
# including its Class, the Constants and instance_methods defined inside it.
#
# The "depth" parameter indicates how deeply it should inspect the object.
# By default there is no depth limit. Pass in 1 to just get info on the object itself.
#
@alexanderscott
alexanderscott / append-conditional-amd
Created February 25, 2013 12:49
Add AMD compliance to the end of a script
if (typeof define == 'function' && define.amd)
define(function() { return myObject })
else
window.myObject = myObject
<html>
<head>
<script src="lib/jquery-1.6.1.min.js"></script>
<script src="lib/json2.js"></script>
<script src="lib/underscore-min.js"></script>
<script src="lib/backbone-min.js"></script>
<script language="javascript">
$(function(){
var LoginView = Backbone.View.extend({
// Log any kind of Web Intent event to Google Analytics
// Category: "twitter_web_intents"
// Action: Intent Event Type
// Label: Identifier for action taken: tweet_id, screen_name/user_id, click region
// First, load the widgets.js file asynchronously
window.twttr = (function (d,s,id) {
var t, js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return; js=d.createElement(s); js.id=id;
js.src="//platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs);
/* LIKE */
FB.Event.subscribe('edge.create', function(href, widget) {
alert('You just liked the page!');
});
/* FEED DIALOG FB.UI
http://developers.facebook.com/docs/reference/javascript/FB.ui/
http://developers.facebook.com/docs/reference/dialogs/