Skip to content

Instantly share code, notes, and snippets.

View orthodoc's full-sized avatar
🎯
Focusing

Biswajit Dutta Baruah orthodoc

🎯
Focusing
View GitHub Profile
require "spec_helper"
describe ExampleController do
context "GET #index" do
let(:resources) { FactoryGirl.create_list(:resource) }
before do
get :index
end
@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) {
/**
* 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) {
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);
});
#!/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;

Movies Recommendation:

Music Recommendation:

@orthodoc
orthodoc / gist:5f0060ec7eed6bda9ce2
Last active September 21, 2015 08:09 — forked from jason-engage/gist:e072cc300fd789e8841e
Ionic Register Push Function Example with Payload and ionicPopup for Android and IOS
//Here is the curl commands I use to test - make sure you update the CAPSVARS. You can add an item ID Payload or not.
//For example if your app displays items, it can navigate to a specific item.
//If you want to add more state names, instead of only going to specific items:
//add another payload property called 'stateName'
//create a goState() function to accept a stateName as a parameter
//and modify the registerPush() to find the stateName property and pass into your goState().
//Android
curl -u YOURAPIKEY: -H "Content-Type: application/json" -H "X-Ionic-Application-Id: APPID" https://push.ionic.io/api/v1/push -d '{"tokens":["ANDROIDTOKEN"],"notification":{"alert":"I come from planet Ion.", "android":{"title":"This is a title2", "payload":{"sound":"notification.mp3","itemId":"7TF00hJI78Y"}}}}'
@orthodoc
orthodoc / gist:852eef177e62cdaff13f
Last active September 21, 2015 08:15 — forked from jason-engage/gist:56b3df8f294af35cd58d
Gulp File for Minifying / Concat / Removing Comments and Console logs of Ionic Project
var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var compass = require('gulp-compass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var sh = require('shelljs');
var path = require('path');
import {Sql} from "../providers/Sql";
export class ExamplePage {
constructor(private sql: Sql) {
//sql.query(...);
//...
}
}
@orthodoc
orthodoc / gist:4bc09545a752f3894515a57ec51edfb4
Created March 13, 2017 07:03 — forked from MadMartigan/gist:641318f4d3b407cb8eeac79a591944c1
Postgrest SSL reverse proxy config for nginx
# domain.com nginx config
server {
listen 443;
server_name domain.com;
return 301 https://www.$server_name$request_uri;
}
server {
listen 80;