Skip to content

Instantly share code, notes, and snippets.

View orthodoc's full-sized avatar
🎯
Focusing

Biswajit Dutta Baruah orthodoc

🎯
Focusing
View GitHub Profile
#!/usr/bin/env node
/**
* Module dependencies
*/
var Async = require('async');
var Filesystem = require('machinepack-fs');
var Prompts = require('machinepack-prompts');
var Sails = require('sails').Sails;
User.find(id).populate('preferences').exec(function (err, user) {
if(err) {
sails.log.error("ERR:", err);
}
sails.services['util'].populateDeep('user', user[0], 'preferences.nestedPreferences', function (err, newUser) {
if (err) {
sails.log.error("ERR:", err);
}
console.log(newUser);
});
/**
* api/models/User.js
*
* The user model contains the instance method for validating the password.
*/
var bcrypt = require('bcrypt');
function hashPassword(values, next) {
bcrypt.hash(values.password, 10, function(err, hash) {
@orthodoc
orthodoc / User.js
Last active August 29, 2015 14:18 — forked from adityamukho/User.js
/**
* api/models/User.js
*
* The user model contains the instance method for validating the password.
*/
var bcrypt = require('bcrypt');
function hashPassword(values, next) {
bcrypt.hash(values.password, 10, function(err, hash) {
require "spec_helper"
describe ExampleController do
context "GET #index" do
let(:resources) { FactoryGirl.create_list(:resource) }
before do
get :index
end
####Download the data from Government of India open data portal#####
w_dir = getwd()
source(file=file.path(w_dir,"Code/Core.R"))
checkAndDownload(c("XML","RCurl","RJSONIO","plyr"))
### Alternative - 1: Using APIs ###
#JSON#
getJSONDoc <- function(link, res_id, api_key, offset, no_elements){
jsonURL = paste(link,
"resource_id=",res_id,
# # act like GNU screen
unbind C-b
set -g prefix C-a
# Allow C-A a to send C-A to application
bind C-a send-prefix
# start window index of 1
set -g base-index 1
export PROJECT_NAME=$1
export WORKING_DIR=~/working/active/$PROJECT_NAME
cd $WORKING_DIR;
tmux start-server
tmux new-session -d -s $PROJECT_NAME -n work
tmux new-window -t$PROJECT_NAME:1 -n server
tmux new-window -t$PROJECT_NAME:2 -n test
@orthodoc
orthodoc / trails.sh
Created March 24, 2014 20:48 — forked from afair/trails.sh
#!/usr/bin/env bash
#
# Script to initiate (or connect to) a rails project
# tmux session.
if [[ "$1" != "" ]]; then
app=$1
APPDIR=$HOME/src/$app
cd $APPDIR
else
" Vim functions to run RSpec and Cucumber on the current file and optionally on
" the spec/scenario under the cursor.
function! RailsScriptIfExists(name)
" Bundle exec
if isdirectory(".bundle") || (exists("b:rails_root") && isdirectory(b:rails_root . "/.bundle"))
return "bundle exec " . a:name
" System Binary
else
return a:name