Skip to content

Instantly share code, notes, and snippets.

Somesh Mukherjee slaith

Block or report user

Report or block slaith

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
View gist:d6093b66ca0fd9000f8bc34d087c8e86
var MongoClient = require('mongodb').MongoClient
, assert = rsuequire('assert');
// Connection URL
var url = 'mongodb://localhost:27017/myproject';
// Use connect method to connect to the server
MongoClient.connect(url, function(err, db) {
assert.equal(null, err);
console.log("Connected successfully to server");
slaith / app.jsx 1
Last active Sep 25, 2016
View app.jsx 1
var TodoItem=React.createClass({
return (<li className="list-group-item "> <div className="row"><div className="col-xs-8">{this.props.pos} {this.props.title}</div><div className="col-xs-2"> <button type="button" className="btn btn-danger " onClick={this.deleteMe} >X Delete</button></div></div></li>);
var TodoList=React.createClass({
slaith / app.jsx
Last active Sep 25, 2016
Template Code
View app.jsx
var Counter=React.createClass({
return (<div></div>)
slaith / app.js
Created Sep 25, 2016
ReactWorkshop Step1
View app.js
var HelloWorld=React.createClass({
return React.createElement("div",{"className":"bright",id:"gello"},"HelloWorld");
ReactDOM.render(React.createElement(HelloWorld,null), document.getElementById("app"));
slaith / environments.json
Last active Sep 23, 2016
GULP: Amazon S3 publish with git based checking
View environments.json
slaith / nginx
Created Aug 3, 2015
Nginx Init script
View nginx
#! /bin/sh
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
slaith / _form.html.slim
Created Jun 9, 2015
Generator template for Bootstrap _form with error display on each field
View _form.html.slim
= form_for(@<%= singular_table_name %>, html: { class: "form-horizontal", role: "form" }) do |f|
- if @<%= singular_table_name %>.errors.any?
.alert.alert-danger.alert-dismissable role="alert"
button.close type="button" data-dismiss="alert"
span aria-hidden="true"
| &times;
| Close
h4= "#{pluralize(@<%= singular_table_name %>.errors.count,"error")} prohibited this <%= singular_table_name %> from being saved:"
slaith / gist:6459693
Created Sep 6, 2013
Database singleton
View gist:6459693
class Database{
static private $_instance;
static $hostname="";
static $username="";
static $password="";
static $database="";
static function getInstance(){
slaith / item.rb
Created Sep 3, 2013
item.rb error
View item.rb
class Item < ActiveRecord::Base
attr_accessible :name, :price, :priority,:picture,:url
belongs_to :user
validates :name, presence: true
validates :price, presence: true
validates :price, length: { :maximum => 7}
has_attached_file :picture,:styles => {:small => "100x100>"}
validates_attachment_size :picture, :less_than => 5.megabytes
validates :url, format: /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$)/ix
validates_attachment_content_type :picture, :content_type => ['image/jpeg', 'image/png']
You can’t perform that action at this time.