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
$('#some-answers').fadeIn() |
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
(defun allpossibilities (total coins) | |
"Given a total amount of money, and a list of denominations, return the total number of possible combinations of denominations that would sum up to total" | |
(let ((ans-table (make-hash-table :test 'equal))) | |
(labels ((iter (left ans) | |
(cond ((= left 0) (setf (gethash (sort (copy-list ans) #'>) ans-table) 1)) | |
((< left 0) nil) | |
(t (dolist (coin coins) | |
(iter (- left coin) | |
(cons coin ans))))))) | |
(iter total nil)) |
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
import java.util.Arrays; | |
public class MakeChange | |
{ | |
// Returns the count of all possible ways to make exact change for the | |
// given total using the coin denominations in the coins[] array. | |
// | |
// Each coin can be used more than once, but the order of the coins is | |
// irrelevant (in other words, "1, 1, 2" and "1, 2, 1" count as a | |
// single possibility.) |
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
cat <<EOT > .git/hooks/pre-push | |
#!/bin/sh | |
npm test | |
EOT | |
chmod +x .git/hooks/pre-push |
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 express = require('express'); | |
var app = express(); | |
var co = require('co'); | |
function * sleep(){ | |
var p = new Promise(function(w,f){ | |
setTimeout(w,1000,'winning'); | |
}); | |
return yield p; |
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
already have downloaded too | |
http://www.uxpin.com/consistency-ui-design-creativity.html |
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 failPromise = new Promise(function(accept,reject){ | |
setTimeout(reject,1000,'fail'); | |
}); | |
// won't see the numbers logged, will skip to the fail | |
failPromise.then(()=> console.log(1)) .then(()=> console.log(2)) .catch((e)=> console.log(':::%s',e)); |
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
# Logfile created on Tue Oct 26 21:16:39 -0200 2010* Loaded locales: ["brca", "da", "de", "el", "en", "eo", "es", "es-419", "fr", "gl", "ia", "id", "it", "ja", "ko", "mk", "nl", "pt-BR", "pt-PT", "ru", "te"] | |
admin['$cmd'].find({:ismaster=>1}, {}).limit(-1) | |
shapado-development['$cmd'].find({"$eval"=>"db.system.js.save({_id: 'find_tags', value: function find_tags(collection, regex, query, limit) {\n var counts = db.eval(\n function(collection, regex, query){\n var counts = {};\n db[collection].find(query, {\"tags\":1}).limit(500).forEach(\n function(p){\n if ( p.tags ){\n for ( var i=0; i<p.tags.length; i++ ){\n var name = p.tags[i];\n if(name.match(regex) != null)\n counts[name] = 1 + ( counts[name] || 0 );\n }\n }\n }\n );\n return counts;\n },\n collection,\n regex,\n query\n );\n\n var tags = [];\n for ( var tag in counts ){\n tags.push( { name : tag , count : counts[tag] |
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 ActionLogger | |
@@queue = [] | |
@@limit = (Rails.env == 'development' ? 0 : 100 ) | |
def self.add(str) | |
@@queue.push(str) | |
store! if @@queue.size >= @@limit | |
end | |
def self.store! |
OlderNewer