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
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"
{
"always_prompt_for_file_reload": false,
"always_show_minimap_viewport": false,
"animation_enabled": true,
"atomic_save": true,
"auto_close_tags": true,
"auto_complete": true,
"auto_complete_commit_on_tab": false,
"auto_complete_delay": 50,
"auto_complete_selector": "source - comment, meta.tag - punctuation.definition.tag.begin",
# Execute action
# $timeout(function() {
# $scope.invited = true
# }, 1000);
# IONIC BACKDROP EXAMPLE
# $ionicBackdrop.retain()
# $timeout(function() {
addToList: (listId, userids) ->
userObj = userids.map (i) -> { id: i }
console.log 'HTTP:addUsersToList', userObj, listId
promise = $http.post(API_ENDPOINT + "/list/?access_token=" + Session.store.get("access_token"),
[
{