This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "spec_helper" | |
describe ExampleController do | |
context "GET #index" do | |
let(:resources) { FactoryGirl.create_list(:resource) } | |
before do | |
get :index | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# # 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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 |