Skip to content

Instantly share code, notes, and snippets.

Madhusudhan Srinivasa madhums

Block or report user

Report or block madhums

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@madhums
madhums / gist:71eaa203f11a428cb8a2
Created Jun 14, 2014
remove files of a type recursively
View gist:71eaa203f11a428cb8a2
$ find app/views -name "*.jade" -type f|xargs rm -f
View req.js
var http = require('http')
var i = 0;
var j = 0;
// write data to request body
setInterval(function(){
console.log('\n');
i = i + 1;
console.log('Sending request: ' + i);
http.get("http://localhost:3000", function(res) {
j = j + 1;
View .jshintrc
{
"bitwise": false,
"immed": true,
"newcap": true,
"noarg": true,
"noempty": true,
"nonew": true,
"trailing": true,
"boss": true,
"eqnull": true,
@madhums
madhums / .jshintignore
Last active Aug 29, 2015
Setup jshint and pre-commit checks
View .jshintignore
node_modules
public/components
public/dist
@madhums
madhums / res.js
Last active Aug 29, 2015
returned object
View res.js
function callback (err, res) {
// res.request.href => is this is url of the uploaded file?
}
fs.createReadStream('image-1.png').pipe(client.upload({
container: 'a-container',
remote: 'image-1.png'
}), callback);
// res =>
/*
@madhums
madhums / node-file-structure.js
Last active Aug 29, 2015
structure for writing module/api in node
View node-file-structure.js
/**
* Module dependencies.
*/
var http = require('http'); // native modules first
var mongoose = require('mongoose'); // npm modules second
var config = require('config'); // modules that are required via NODE_PATH third
var fmt = require('./format-date'); // local modules fourth
var oauth = require('../../oauth'); // relative modules last
@madhums
madhums / gulpfile.js
Created Jul 18, 2015 — forked from danharper/gulpfile.js
ES6 project with Babel, Browserify & Gulp
View gulpfile.js
'use strict';
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
@madhums
madhums / to-go.md
Last active Sep 3, 2015
pleinvrees heroes
View to-go.md
  • n'to
  • workals
  • oliver schoris
  • oliver koletzki
  • andhim
@madhums
madhums / minifind.rb
Created Nov 12, 2010
mini-find - this will save a few key strokes!
View minifind.rb
class << ActiveRecord::Base
alias_method :[], :find
end
@post = Post[5]
@post = Post[:first]
@post = Post[:all, :conditions => { :name => "first post" }]
@madhums
madhums / omniauth.rb
Created Nov 15, 2010
OmniAuth configuration for rails 2.3.x
View omniauth.rb
#config/initializers/omniauth.rb
require 'openid/store/filesystem'
ActionController::Dispatcher.middleware.use OmniAuth::Builder do #if you are using rails 2.3.x
#Rails.application.config.middleware.use OmniAuth::Builder do #comment out the above line and use this if you are using rails 3
provider :twitter, 'key', 'secret'
provider :facebook, 'app_id', 'secret'
provider :linked_in, 'key', 'secret'
provider :open_id, OpenID::Store::Filesystem.new('/tmp')
end
You can’t perform that action at this time.