Skip to content

Instantly share code, notes, and snippets.

View shanlalit's full-sized avatar

Lalit Shandilya shanlalit

View GitHub Profile
@shanlalit
shanlalit / in_relentless_pursuit_of_rest_notes.md
Created January 24, 2022 13:29 — forked from benoittgt/in_relentless_pursuit_of_rest_notes.md
"In Relentless Pursuit of Rest" from Derek Prior
@shanlalit
shanlalit / client.js
Last active August 29, 2015 14:02
Seneca Client
var seneca = require('seneca')()
//send any actions it can not match locally out over the network
//Change 127.0.0.1 to server ip
seneca.client({host:'127.0.0.1'})
seneca.use('transport',{
pins:[ {role:'math',cmd:'product'} ]
})
# app/controllers/graphs_controller.rb
def show
...
@presenter = GraphPresenters::LineGraphPresenter.new graph
end
@shanlalit
shanlalit / README.markdown
Created May 22, 2012 09:38 — forked from isc/README.markdown
A micro gem providing an accordion view helper and a tabs view helper that generate the proper markup for Twitter Bootstrap

Twitter Bootstrap Components Helper

Provides an accordion helper and a tabs helper

In your Gemfile:

gem 'bootstrap-components-helpers', :git => 'git://gist.github.com/2117187.git'

Accordion helper:

@shanlalit
shanlalit / notify.js
Created February 1, 2012 05:14 — forked from gautamrege/notify.js
Notification node server
var express = require('express')
, app = express.createServer()
, io = require('socket.io').listen(app);
app.use(express.bodyParser());
app.listen(13002);
var connections = {}
@shanlalit
shanlalit / Changes to Support Single-User RVM Install
Created December 30, 2011 08:58
Munin passenger plugin with Single-User RVM Install
Munin Passenger Plug-in Installation
Configure the passenger plug-ins according the the guide on http://www.alfajango.com/blog/how-to-monitor-your-railspassenger-app-with-munin/
NOTE: restart munin after implementing the following changes for Single-User RVM
sudo nano /etc/munin/plugin-conf.d/munin-node
[passenger_*]
user root
# config/initializers/carrierwave.rb
CarrierWave.configure do |config|
config.grid_fs_database = "database_name"
config.grid_fs_host = 'localhost'
config.grid_fs_access_url = "/uploads"
config.storage = :grid_fs
end
# To parse a tweet from twitter to get teh '@' , '#' and the text seperated
parsed_text = tweet.text.gsub(/ ?(@\w+)| ?(#\w+)/) { |a| ((a.include?('#')) ? tags : replies) << a.strip.gsub(/#|@/,''); '' }
# crappy server implementation using technoweenie/oauth2 (server branch)
# http://github.com/technoweenie/oauth2/compare/master...server
#
# ruby oauth2_example.rb -p 4568
# ruby oauth2_example.rb
# open http://localhost:4567/auth/facebook
require 'rubygems'
require 'sinatra'
require 'oauth2/client'
@shanlalit
shanlalit / super.rb
Created April 30, 2010 16:06 — forked from lifo/super.rb
# [] - Eqauls to
# ^ - Not equals to
# =~ - LIKE
# >, >=, <, <= works as expected
#
# Examples :
#
# Item.where(:colour['Red'], :quanity > 10, :price <= 200)
# Post.where(:comments_count >= 1, :taggings_count < 5)
# User.where(:country ^ 'US') # Non american users