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
javascript:(function()%7Bvar%20%24rows%3D%24('%23transfers_list%20tr%3Agt(0)')%2Corders%3D%5B%5D%2CtotalQuantity%3D0%2CtotalPrice%3D0%3B%24rows.each(function()%7Bvar%20a%3D%24.trim(%24(this).find('td%3Aeq(5)').text()).split('%20')%5B0%5D*1%2Cquantity%3D%24.trim(%24(this).find('td%3Aeq(3)').text()).split('%20')%5B0%5D*1%3Borders.push(%7Bquantity%3Aquantity%2Crate%3Aa%7D)%7D)%3B%24.each(orders%2Cfunction(i%2Ca)%7Bvar%20b%3Da.rate*a.quantity%3BtotalQuantity%2B%3Da.quantity%3BtotalPrice%2B%3Db%7D)%3Balert('paid%20average%20of%3A%20'%2B(totalPrice%2FtotalQuantity)%2B'%20for%20'%2BtotalQuantity)%7D)() |
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
// Go to the URL below and execute this JavaScript to calculate your coinbase average Bitcoin purchase price and the total purchased. | |
// https://coinbase.com/transfers | |
// Bookmarklet can be found here: https://gist.github.com/sgreenfield/9258154 | |
var $rows = $('#transfers_list tr:gt(0)'), orders = [], totalQuantity = 0, totalPrice = 0; | |
$rows.each(function(){ | |
var rate = $.trim( $(this).find('td:eq(5)').text() ).split(' ')[0] * 1, | |
quantity = $.trim( $(this).find('td:eq(3)').text() ).split(' ')[0] * 1; | |
orders.push({ quantity: quantity, rate: rate }); |
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
Date.prototype.toRelativeTime = function(date) { | |
var delta = date - this, units, conversions; | |
conversions = { | |
millisecond: 1, // ms -> ms | |
second: 1000, // ms -> sec | |
minute: 60, // sec -> min | |
hour: 60, // min -> hour | |
day: 24, // hour -> day | |
month: 30, // day -> month (roughly) |
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
$(document).keypress(function(e) { | |
var code = (e.keyCode) ? e.keyCode : e.which, character; | |
if(e.charCode && code !== 32 && code !== 13 && !e.altKey && !e.ctrlKey && !e.metaKey){ | |
character = String.fromCharCode(e.charCode); | |
console.log('value: ', character); | |
} | |
}); |
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 updateQueryStringParameter(a, k, v) { | |
var re = new RegExp("([?|&])" + k + "=.*?(&|$)", "i"), | |
separator = a.indexOf('?') !== -1 ? "&" : "?"; | |
if (a.match(re)) return a.replace(re, '$1' + k + "=" + v + '$2'); | |
else return a + separator + k + "=" + v; | |
} |
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 parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
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
ಠ_ಠ | |
ಠ~ಠ | |
ಠoಠ | |
ಠxಠ | |
ಠ.ಠ |
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
define([ | |
'jQuery', | |
'Underscore', | |
'Backbone', | |
'modules/feed', | |
'modules/files', | |
'modules/members', | |
'modules/misc/GBL', | |
'modules/misc/lightbox' | |
], function($, _, Backbone, Feed, Files, Members, GBL, Lightbox){ |
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
class CustomFailure < Devise::FailureApp | |
# Never do http authentication through Devise | |
def http_auth? | |
false | |
end | |
def redirect_url | |
send(:"new_#{scope}_session_path", :format => (request.xhr? ? 'js' : nil )) | |
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
/** | |
* jQuery.support.cssProperty | |
* To verify that a CSS property is supported | |
* (or any of its browser-specific implementations) | |
* | |
* @param p css property name | |
* @param rp optional, if set to true, the css property name will be returned | |
* instead of a boolean support indicator | |
* @return {mixed} | |
* |
NewerOlder