Skip to content

Instantly share code, notes, and snippets.

FAQ: Can you watch my stuff for me while I go use the bathroom?

Ok, it's bad enough that we live in a society where people steal, rape and pillage. The only thing worse is when someone accepts that society as normal, starts dividing people into good and bad groups, never once taking any responsibility for their surroundings. Living completely in a box without any sense of moral responsibility for their environment. This is true ignorance and lack of culture. Yes "accountability" has a dark side -- it's another word for blame. We all shed the responsibility of creating a better world when this happens. It's immoral and self-defeating. It's wrong.

@mandric
mandric / gist:3959916
Created October 26, 2012 16:59 — forked from guyht/gist:1684328
Twitter Bot in NodeJS
/*
* Load external modules and init variables
*/
var twitter = require('ntwitter'),
http = require('http'),
bitly = require('bitly'),
b = new bitly('USER', 'API_KEY'),
tweeted = {},
load_time = Math.round(new Date().getTime() / 1000),
score_threshold = 100;
@mandric
mandric / events.js
Created May 3, 2012 16:21
kanso session handling
// lib/events.js
// topnav ala bootstrap
// stores a reference to the modal dialog
var m;
session.on('change', function (userCtx) {
if (!$('#session_menu').length) {
$('#topnav .pull-right').append(
#!/usr/bin/env python
import os,sys
tiles = []
if len(sys.argv) != 2:
print 'Usage: upload-files db'
exit(1)
else:
db = sys.argv[1]
exports.env = {
// the default env will be used when you just do "kanso push"
default: {
db: "http://username:password@hostname:5984/dbname"
},
// you can also define named environments this one will
// be used when you do "kanso push production"
production: {
db: "http://username:password@production-hostname:5984/production-db",
// tells the module package to minify modules.js
var rewrites = require('kujua-sms/rewrites').rules,
_ = require('underscore')._;
/**
* Rewrite settings to be exported from the design doc
*/
module.exports = _.union(rewrites, [
{from: '/static/*', to: 'static/*'},
{from: '/install', to: '_show/docs', method: 'GET'},
var jsDump = require('jsDump'),
settings = require('settings/root');
var logger = exports.logger = {
levels: {silent:0, error:1, info:2, debug:2},
log: function(obj) {
if (typeof log !== 'undefined')
log(jsDump.parse(obj));
if (typeof console !== 'undefined')
console.log(obj);
@mandric
mandric / gist:1782893
Created February 9, 2012 20:35
http request that does a callback request
// http request that does a callback request
var req = function(options) {
var r = http.request(options, function(res) {
var resBody = '';
res.setEncoding('utf8');
res.on('data', function (chunk) {
resBody += chunk;
});
res.on('end', function() {
var resJSON = JSON.parse(resBody);
$ kanso push
loading .
loading packages/modules
Error: Error: Cannot find module 'kanso/modules'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object.<anonymous> (/Users/mandric/dev/kujua-export/packages/modules/build/add.js:1:77)
at Module._compile (module.js:432:26)
$ npm install -g kanso
npm ERR! error installing kanso@0.1.2 Error: Unsupported
npm ERR! error installing kanso@0.1.2 at checkEngine (/Users/mandric/local/node/lib/node_modules/npm/lib/install.js:570:14)
npm ERR! error installing kanso@0.1.2 at Array.0 (/Users/mandric/local/node/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
npm ERR! error installing kanso@0.1.2 at LOOP (/Users/mandric/local/node/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:13)
npm ERR! error installing kanso@0.1.2 at chain (/Users/mandric/local/node/lib/node_modules/npm/node_modules/slide/lib/chain.js:20:4)
npm ERR! error installing kanso@0.1.2 at installOne_ (/Users/mandric/local/node/lib/node_modules/npm/lib/install.js:548:3)
npm ERR! error installing kanso@0.1.2 at installOne (/Users/mandric/local/node/lib/node_modules/npm/lib/install.js:488:3)
npm ERR! error installing kanso@0.1.2 at /Users/mandric/local/node/lib/node_modules/npm/lib/install.js:425:9
npm ERR! error installing kanso@