Skip to content

Instantly share code, notes, and snippets.

View vasanthk's full-sized avatar

Vasa vasanthk

View GitHub Profile
vasanthk /
Created November 19, 2013 22:55
Huge Inserts
// Fields by type
$int_fields = [
'permanent' => check_plain( $form_state['values']['additional']['permanent_directory'] ),
'app_id' => $app_info->id,
'level_1_field_id' => check_plain( $form_state['values']['level1']['level1_field'] ),
'level_2_field_id' => check_plain( $form_state['values']['level2']['level2_field'] )
$string_fields = [
'permanent_empty_template' => $form_state['values']['additional']['permanent_empty_template'],
'name' => check_plain( strtolower($form_state['values']['level1']['name']) )
vasanthk / gist:8346114
Last active January 2, 2016 18:49
IE in Ubuntu
Update your PlayonLinux in Ubuntu:
wget -q "" -O- | sudo apt-key add -
sudo wget -O /etc/apt/sources.list.d/playonlinux.list
sudo apt-get update
sudo apt-get install playonlinux
<script src=""></script>
<script src=""></script>
function auth() {
var config = {
'client_id': 'OAUTH_CLIENT_ID',
'scope': ''
vasanthk / node-http-post-listener.js
Created April 20, 2015 12:13
A simple http server that listens for POST events at port 9000 and will print out the data it receives. This is useful for setting up as the url for a webhook and viewing/verifying the data that gets sent to that URL.
var app = require('http').createServer(handler);
var statusCode = 200;
function handler (req, res) {
var data = '';
if (req.method == "POST") {
req.on('data', function(chunk) {
vasanthk /
Created April 21, 2015 18:58

Keybase proof

I hereby claim:

  • I am vasanthk on github.
  • I am vasa ( on keybase.
  • I have a public key whose fingerprint is 0872 9F46 406A ABE5 4EBC F69A 1BA1 6FF2 9340 598D

To claim this, I am signing this object:

"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"classes": true,
vasanthk / .eslintrc
Created April 27, 2015 23:05
React + ES6 --- ESLint
"parser": "babel-eslint",
"env": {
"browser": true,
"es6": true,
"node": true
"ecmaFeatures": {
"arrowFunctions": true,
"binaryLiterals": true,

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set "Your Name"
npm set ""
npm set ""

npm adduser

Better local require() paths for Node.js


When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

vasanthk / dispatcher-callback.txt
Created June 11, 2015 06:06
Difference between Dispatcher and callbacks
Dispatcher is used to broadcast payloads to registered callbacks. This is different from generic pub-sub systems in two ways:
1) Callbacks are not subscribed to particular events. Every payload is dispatched to every registered callback.
2) Callbacks can be deferred in whole or part until other callbacks have been executed.