This file contains hidden or 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
//process n number of async functions in order. used when promises aren't viable e.g. cross file or service calls. | |
var MiddlewareService = function(){ | |
var stack = [], | |
isProcessingStack = false, | |
commonState = { task: 0 }; | |
function push(fn){ | |
stack.push(fn); |
This file contains hidden or 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
<script src="mraid.js"></script> | |
<!--april 1--><head> | |
<meta name="viewport" content="width=device-width, user-scalable=no"> | |
</head> | |
<script>if (!window.mraid) { document.write('<script src="http://cdn.engagefront.com/mraid-basic.js"><\/script>'); }</script> | |
<script> | |
!function(a){a.setTimeout(function(){var b=a.document,c="engagefront",d="/EngageMetrics/v1/",e="script",f=b.getElementsByTagName(e)[0],g=b.createElement(e),h=b.location,i=h.protocol;g.src="https:"===i?"https://"+c+"-a.akamaihd.net"+d:"http://cdn."+c+".com"+d,f.parentNode.insertBefore(g,f)},0)}(window); | |
</script> | |
<style> |
This file contains hidden or 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
String.prototype.hashCode = function() { | |
var hash = 0, i, chr, len; | |
if (this.length == 0) return hash; | |
for (i = 0, len = this.length; i < len; i++) { | |
chr = this.charCodeAt(i); | |
hash = ((hash << 5) - hash) + chr; | |
hash |= 0; // Convert to 32bit integer | |
} | |
return hash; | |
}; |
This file contains hidden or 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
_, seq = STDIN.read.scan(/(\n>THREE[^\n]*\n)([^>]*)\n/).flatten | |
p _, seq | |
# you can run this file as `ruby scan.rb < test`, where test contains the text to match | |
# it matches something like this, note the new line at beginning | |
# |
This file contains hidden or 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
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0Gws3wF4N6Yzm6nAXg4ub7InIpYqUm4j/1N1HOIcxfblr2kS9NZ8dHUdZMVhCjHvkrEpExH9OdFjTVzbfYtMNvX8XOCOglosdTrGXwJrO3vg5Emz9ntu6DXgA26SxMi7dQnKjZKPxi6e7+Tx82BC62pAmr/nrVQTOM6fa+682KwEmk4ONXXcc8WObiC3Lk8AEbDS9WTB+ejcKTwRH4lMX5OFyZ1aEux8PL35Iu4hIU7fwSn8zspnuCLyEyhLElPAg3e7k2wxd/9rySPPKntYzZ4YnhUNC+E6JTEhhRlbXpWL8O54xph+bs8GG5kjyGDzZK3vUU7ue/c+Fh8Kr4nAZ [email protected] |
This file contains hidden or 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 Solution: | |
# @param board, a 2D array | |
# Capture all regions by modifying the input board in-place. | |
# Do not return any value. | |
def solve(self, b): | |
if len(b) == 0: | |
return [] | |
board = [list(x) for x in b] | |
allEntrances = self.findAllEntrances(board) | |
This file contains hidden or 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 log = console.log.bind(console); | |
/** | |
* Given a ad | |
* calculate max bid rate | |
*/ | |
function calculate_max_bid_rate(ad) { | |
var org_chain = get_org_chain(ad); |
This file contains hidden or 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
/** | |
* get remaining time | |
* @param {string} start - UTC/ISO time string | |
* @param {string} end - UTC/ISO time string | |
*/ | |
function getRemainingTime(start, end) { | |
start = moment(start), end = moment(end); | |
var now = moment(); | |
if (now > end) { |
This file contains hidden or 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
/** | |
* matchFilter | |
* @param {Object} term - key:val pairs that model need to match | |
* @returns {boolean} | |
*/ | |
Backbone.Model.prototype.matchFilter = function (conditions) { | |
return _.every(conditions, function (val, key) { | |
return this.get(key) === val; | |
}, this); |
This file contains hidden or 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
set runtimepath^=~/.vim runtimepath+=~/.vim/after | |
let &packpath = &runtimepath | |
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim/ | |
let path='~/vimfiles/bundle' | |
call vundle#begin(path) |