Skip to content

Instantly share code, notes, and snippets.

View dboundz's full-sized avatar

D4RRΞN dboundz

  • Independent
View GitHub Profile
@dboundz
dboundz / am I dumb?
Created August 14, 2012 14:32
Closure question.
var get_info = function(list_id, callback) {
// do something and callback with list_info for list_id;
callback(null, list_info);
};
var list = [1,2,3,4,5];
for(var i = 0; i < list.length; i++) {
var list_id = list[i];
get_info(list_id, function (error, list_info) {
// do work on list info and save new data based on list_id;
@dboundz
dboundz / github_oauth2.js
Created October 12, 2012 01:54
Express Github OAuth2 flow
exports.github = function (req, res) {
res.redirect(config.Github.API_ROOT + config.Github.PATH_AUTHENTICATE + '?client_id=' + config.Github.CLIENT_ID);
};
exports.githubCallback = function (req, res) {
var code = req.query.code;
var post_data = querystring.stringify({
code: code
, client_id: config.Github.CLIENT_ID
@dboundz
dboundz / gist:4014998
Created November 5, 2012 02:40
adsfkljasdfkajdflakjlaksdjf lakjfalksdfj alskdfj asldkfjasldfkjasflkajsflkasjflkasjdflkasdjflasdjlaskdfjlasdkfjsdlkfsdlkfjlksdf
adf
root@ip-10-143-152-37 cassandra]# /usr/local/cassandra/bin/nodetool -h localhost netstatsMode: Bootstrapping
Not sending any streams.
Nothing streaming from /10.143.152.214
Pool Name Active Pending Completed
Commands n/a 0 913
Responses n/a 0 40414
[root@ip-10-143-152-214 commitlog]# nodetool -h localhost ring
Address Status State Load Owns Token
147812841064642050890573067299308376119
10.143.152.214 Up Normal 17.63 GB 16.92% 6465521443762750910879932401790818283
10.143.137.229 Up Normal 15.42 GB 14.29% 30770464449828574333878666977671705387
10.189.191.190 Up Normal 14.55 GB 14.29% 55081439847684911199083914992341627091
10.142.148.169 Up Normal 9.89 GB 26.30% 99830924686836618129013673651943109407
10.143.151.252 Up Normal 9.76 GB 12.38% 120896070024475770381967707443124891876
10.143.152.37 Up Joining 6.12 GB 15.82% 147812841064642050890573067299308376119
@dboundz
dboundz / gist:6334280
Created August 25, 2013 14:58
SliceQuery
SliceQuery<String, String, String> query = HFactory.createSliceQuery(CassandraHelper.keyspace, CassandraHelper.STRING_SERIALIZER, CassandraHelper.STRING_SERIALIZER, CassandraHelper.STRING_SERIALIZER);
query.setColumnFamily("user_graph")
.setRange("", "", true, 50)
.setColumnNames(targetUserId)
.setKey(userId + "_" + type);
Darrens-MacBook-Pro:news-collection-client dbounds$ node collector.js nba
Requesting page: http://bleacherreport.com/articles/1770310-jim-buss-says-father-jerry-buss-made-final-call-on-mike-dantoni-over-phil-jacks
Requesting page: http://bleacherreport.com/articles/1770256-man-buys-300-storage-unit-and-unearths-dikembe-mutombo-memorabilia-collection
Requesting page: http://bleacherreport.com/articles/1769525-why-the-minnesota-timberwolves-can-be-legitimate-contenders-in-2013-14
Requesting page: http://bleacherreport.com/articles/1769982-why-dwyane-wade-dictates-lebron-james-long-term-miami-heat-future
Requesting page: http://bleacherreport.com/articles/1770100-lebron-james-has-much-to-consider-in-2014-nba-free-agency
Requesting page: http://bleacherreport.com/articles/1769737-way-too-early-predictions-for-kobe-bryants-return-to-la-lakers-in-2013-14
Requesting page: http://bleacherreport.com/articles/1769839-why-kobe-bryants-early-return-from-injury-is-exactly-what-the-nba-needs
Requesting page: http://bleache
@dboundz
dboundz / gist:d1ce8261c0be7e50e9e6
Created July 23, 2014 19:06
Swift extensions...
extension Int {
func repeat(task: () -> ()) {
for i in 0..self {
task()
}
}
}
500.repeat {
println("hello")
baseApp.filter("emptyToEnd", function () {
return function (array, key) {
var keys = key.split(".");
if (!angular.isArray(array)) return;
var present = array.filter(function (item) {
if(keys.length > 1) {
return item[keys[0]][keys[1]];
} else {
return item[keys[0]];
<!DOCTYPE html>
<html>
<body>
<h1>What were you expecting?</h1>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');