Skip to content

Instantly share code, notes, and snippets.

View cggaurav's full-sized avatar
🏠
Working from home

Gaurav cggaurav

🏠
Working from home
View GitHub Profile
@cggaurav
cggaurav / gist:8373886
Created January 11, 2014 17:26
Diable Notification Center | Mavericks
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
killall NotificationCenter
#launchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
@cggaurav
cggaurav / gist:8685936
Created January 29, 2014 11:11
Default Node Web App Monit Template
check host node_web_app_<%= @application_name %> with address 127.0.0.1
start program = "/bin/sh -c 'cd <%= @deploy[:deploy_to] %>/current; /usr/bin/env NODE_PATH=<%= @deploy[:deploy_to] %>/current/node_modules:<%= @deploy[:deploy_to] %>/current <% (node[:environment_variables] || {}).merge(@deploy[:environment_variables] || {}).each do |name,value| -%><%= name %>=<%= value %> <% end -%> /usr/local/bin/node <%= @monitored_script %>'"
stop program = "/usr/bin/pkill -f 'node <%= @monitored_script %>'"
if failed port 80 protocol HTTP
request /
with timeout 10 seconds
then restart<% %>
check host node_web_app_<%= @application_name %> with address 127.0.0.1
start program = "/bin/sh -c 'cd <%= @deploy[:deploy_to] %>/current; /usr/bin/env NODE_PATH=<%= @deploy[:deploy_to] %>/current/node_modules:<%= @deploy[:deploy_to] %>/current NODE_ENV=production /usr/local/bin/node <%= @deploy[:deploy_to] %>/current/index.js &>> /var/log/node.log'"
app = angular.module 'BlogExample', []
# Simple controller that loads all blog posts
app.controller 'BlogCtrl', ['$scope', 'Blog', ($scope, Blog) ->
# Get all the blog posts
Blog.all().then (posts) ->
$scope.posts = posts
# Extend the $scope with our own properties, all in one big block
# I like this because it looks like declaring a class.
# Name: EXIFmover.py
# Author: Brian Klug (@nerdtalker / brian@brianklug.org)
# Purpose:
# Move Files into directory based on EXIF data make and model
# Designed to un-clusterfuck the Dropbox camera upload directory which is a mess of every
# JPEG and PNG ever if you use it like I do on a bunch of phones, and thus totally unwieldy
# and full of images sorted by date or else nothing sometimes, dropbox seems nondeterminstic
# Moves files into /[Image Make]+[Image Model]/ eg /Camera Uploads/LGE Nexus 4/
#
# Initialize the stuff
#
# We build the status bar item menu
framework 'AppKit'
def setupMenu
menu = NSMenu.new
menu.initWithTitle 'Flipsicle'
mi = NSMenuItem.new
@cggaurav
cggaurav / user.js
Created June 8, 2014 22:22
Parse Get All
var q = new Parse.Query(Parse.User);
q.find({
success:function(items){
console.log(items.length);
}
});
CACHE MANIFEST
CACHE:
index.html
index.css
index.js
cordova.js
NETWORK:
@cggaurav
cggaurav / stat.js
Created July 18, 2014 00:33
Login state service
angular.module('AuthModule', ['localStorage']).factory('AuthState', function(localStorage) {
'use strict';
var state = {
isLoggedIn: localStorage.get('isLoggedIn')
};
return {
isLoggedIn: isLoggedIn,
};
});
angular.module('controllers', ['AuthState']).factory('SomeCtrl', function($scope, state) {
@cggaurav
cggaurav / delete.coffee
Created July 24, 2014 16:25
DELETE $http
$http(method: 'DELETE', url: path + REST.ids(collection).join(','), params: params)
.success (data, status, headers, config) ->
console.log "#{Quests.name}.delete: OK"
.error (data, status, headers, config) ->
console.error "#{Quests.name}.delete: ERROR"
{
-errors: {
method: ""
url: ""
status: "" - errors: [-{
type: "SystemError"
id: "500_1"
field: "Error"
message: "SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed"
}]