Skip to content

Instantly share code, notes, and snippets.

View verma's full-sized avatar
💭
Working from home because the virus is out to get us!

Uday Verma verma

💭
Working from home because the virus is out to get us!
View GitHub Profile
@verma
verma / gist:4627465
Created January 24, 2013 20:38
Cruder usage
var
cruder = require("../lib/cruder"),
db = require("../lib/db").MySQLConnection;
var c = new cruder.Cruder(db.connection, "locations",
["*title", "*address", "lat", "lng", "*url", "list_url", "map_url", "live_url" ]);
var app = express(); // app is an express app
@verma
verma / Xorg.conf
Created March 1, 2013 22:16
Xorg.conf for static conf
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 256.35 (buildmeister@builder97.nvidia.com) Wed Jun 16 19:15:05 PDT 2010
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 256.35 (buildmeister@builder97.nvidia.com) Wed Jun 16 19:14:45 PDT 2010
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
@verma
verma / simple-wss.js
Created August 17, 2013 23:46
A simple proxied websocket server example
// app.js
// A simple proxying example
//
// Setup websocket server on port 19000
// Setup proxy on port 9000 to proxy to 19000
// Make a websocket request to 9000
//
var WebSocket = require('ws'),
WebSocketServer = WebSocket.Server,
@verma
verma / gist:6309292
Created August 22, 2013 16:08
A simple Vagrantfile which provisions the specified version of node along with automatically adding specified user repos + packages.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.hostname = "point-serve"
@verma
verma / gist:7684962
Created November 27, 2013 23:38
Helpers functions for promises based unit testing
// testq.js
// Test Q based functions
//
var Q = require('q');
var asQ = function(f) {
return function(test) {
f(test).fin(function() {
test.done();
@verma
verma / gist:8059954
Created December 20, 2013 19:21
Simple PDAL pipeline
<?xml version="1.0"?>
<Pipeline version="1.0">
<Filter type="filters.selector">
<Option name="keep">
<Options>
<Option name="dimension">
X
</Option>
<Option name="dimension">
Y
PointCollector.prototype._2dProj = function(p, proj) {
proj = proj || (new THREE.Projector());
var ndc = p.clone();
proj.projectVector(ndc, this.fromCamera);
return new THREE.Vector3(
ndc.x * this.size[0] / 2, ndc.y * this.size[1] / 2, 1.0);
};
(defn join-path
"Join path elements together, if any of the path components start with a /
the function assumes that the path is being reset to root and will ignore all parts
before that"
[p & parts]
(let [p (if (empty? p) "." p)]
(.getPath (reduce #(if (.startsWith %2 "/")
(io/file %2)
(io/file %1 %2)) (io/file p) parts))))
(defn map-vals
"Maps the values of the map col using f"
[f col]
(into {} (map (fn [[a b]] [a (f b)]) col)))
@verma
verma / 0_reuse_code.js
Created April 5, 2014 01:00
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console