Skip to content

Instantly share code, notes, and snippets.

View girasquid's full-sized avatar
🦐

Luke Hutscal girasquid

🦐
View GitHub Profile
@duncanbeevers
duncanbeevers / sc-dl-min.js
Created March 22, 2012 12:16 — forked from pheuter/sc-dl.js
Bookmarklet that generates download link for a Soundcloud upload
(function(window){var i,$sound,$buttonGroup;var $sounds=$(".sound");var clientId=require("config").get("client_id");var oauthToken=require("lib/connect").getAuthToken();var conversionHelper=require("lib/helpers/conversion-helper");var $downloadButton,size;var params,downloadUrl,onSuccess;for(i=$sounds.length-1;i>=0;i--){$sound=$($sounds[i]);var soundcloudUrl="https://soundcloud.com"+($sound.find(".soundTitle__title").attr("href")||window.location.pathname);params={url:soundcloudUrl,client_id:clientId};onSuccess=function($sound){return function(data){var params={client_id:clientId};downloadUrl=require("lib/url").stringify({query:params},data.stream_url+".mp3");$buttonGroup=$($sound.find(".sound__soundActions .sc-button-group")[0]);size=$buttonGroup.find(".sc-button:first")[0].className.match(/sc-button-((?:small)|(?:medium))/)[1];$downloadButton=$('<a class="sc-button sc-button-download sc-button-icon sc-button-responsive">Download</a>').attr({title:"Download this sound ("+conversionHelper.bytesToMB(data.origi
-(void)realAuthenticate {
NSURLRequest *request = [self getURLRequest];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request
success:^( NSURLRequest *request , NSHTTPURLResponse *response , id JSON ) {
NSString *domain = [[(NSArray *)[JSON objectForKey:@"sites"] lastObject] objectForKey:@"domain"];
Portfolio *portfolio = [[Portfolio alloc] init];
portfolio.domain = domain;
self.portfolio = portfolio;
[self finishAuth:YES];
module Watchable
def events
@events ||= Hash.new { |h,k| h[k] = [] }
end
def fire event, *args
events[event].each { |e| e[*args] }
end
def on event, &block
@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);
@tfl
tfl / will_paginate_sinatra_renderer.rb
Created March 4, 2012 09:56
Using will_paginate with Sinatra and Twitter Bootstrap
# make sure to include the needed pagination modules
require 'will_paginate'
require 'will_paginate/view_helpers/sinatra'
module WillPaginate
module Sinatra
module Helpers
include ViewHelpers
def will_paginate(collection, options = {})
@nathany
nathany / LICENSE
Created January 21, 2012 07:19
Pruning remote branches that are already in master
Copyright (C) 2012 Nathan Youngman
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@avhm
avhm / gist:1541764
Created December 30, 2011 22:24
Open current folder in Sublime Text 2 - Add this to your finder Toolbar
tell application "Finder"
set thisFolder to (target of front window) as Unicode text
set posixPath to quoted form of POSIX path of thisFolder
do shell script "/Applications/Sublime\\ Text\\ 2.app/Contents/SharedSupport/bin/subl " & posixPath
end tell
@phoet
phoet / renderer.rb
Last active June 19, 2023 08:59
helps finding which partial to look at in rails4
if Rails.env.development?
module My
module PartialRenderer
def render(context, options, block)
msg = "rendering '#{options[:partial]}' with locals '#{(options[:locals] || {}).keys}'"
"<!-- start #{msg}-->\n#{super(context, options, block)}\n<!-- end #{msg}-->\n".html_safe
end
end
end
package
{
import flash.display.SimpleButton;
import flash.display.Sprite;
import flash.text.Font;
import flash.text.StaticText;
import flash.text.TextField;
/**
* ...
task :cron => :environment do
DatabaseBackup.back_up_to_s3!
end