Skip to content

Instantly share code, notes, and snippets.

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

dhilipsiva dhilipsiva

🏠
Working from home
View GitHub Profile
@dhilipsiva
dhilipsiva / Gruntfile.js
Created November 12, 2013 13:17
Gruntfile.js
// Generated on 2013-10-26 using generator-ember 0.7.1
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
// # Globbing
// for performance reasons we're only matching one level down:
@dhilipsiva
dhilipsiva / gist:7353239
Last active December 27, 2015 16:09
i have this json { cb="Adiesel", litros=47}, Object , Object { cb="Gasolina 95", litros=1327}, Object { cb="Gasolina 98", litros=130}, i need to transform this in { "Adiesel"=47, "Gasóleo"=1008, "Gasolina 95"=1327, "Gasolina 98"=130}
var key, obj, res={}, _i, _len;
collection = [
{cb:"Adiesel", litros:47},
{cb:"Gasóleo", litros:1008}
// etc
];
trans = function(collection){
for (_i = 0, _len = collection.length; _i < _len; _i++) {
property = function(){
//Function body
}.property()
@dhilipsiva
dhilipsiva / HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install foo
Last active December 12, 2015 12:09
neon failed to build on 10.7
==> Downloading http://www.webdav.org/neon/neon-0.29.6.tar.gz
Already downloaded: /Library/Caches/Homebrew/neon-0.29.6.tar.gz
/usr/bin/tar xf /Library/Caches/Homebrew/neon-0.29.6.tar.gz
==> ./configure --disable-debug --prefix=/usr/local/Cellar/neon/0.29.6 --enable-shared --disable-static --with-ssl
./configure --disable-debug --prefix=/usr/local/Cellar/neon/0.29.6 --enable-shared --disable-static --with-ssl
checking for a BSD-compatible install... /usr/bin/install -c
checking for gcc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
@dhilipsiva
dhilipsiva / m.clj
Last active December 11, 2015 03:48 — forked from amitrathore/m.clj
(def m {:a 1,
:c {:a 1, :c {:a 1, :b 2}, :b 2},
:b [2 3],
:d [{:a 1, :c 3, :b 2} {:a [1 2 3], :b {:a 1, :b 2}}]})
@dhilipsiva
dhilipsiva / MPMediaItemCollectionSavePlaylist.m
Created December 15, 2012 14:41
Play iPod playlist retrieved from a saved persistentid list
- (void) mediaPicker: (MPMediaPickerController *) mediaPicker didPickMediaItems: (MPMediaItemCollection *) mediaItemCollection {
[self savePlaylist:mediaItemCollection];
[self dismissModalViewControllerAnimated: YES];
}
- (void)savePlaylist:(MPMediaItemCollection *) mediaItemCollection {
NSArray* items = [mediaItemCollection items];
NSMutableArray* listToSave = [[NSMutableArray alloc] initWithCapacity:0];=
for (MPMediaItem *song in items) {
@dhilipsiva
dhilipsiva / Failed to execute: pip
Created December 7, 2012 12:47
Failed to execute: pip
Failed to execute: pip
HOMEBREW_VERSION: 0.9.3
HEAD: 07bfaf64e7edd77009a6956d58e4e0656b78a9d7
CPU: quad-core 64-bit sandybridge
OS X: 10.7.5-x86_64
Xcode: 4.5.2
CLT: 1.0.0.9000000000.1.1249367152
X11: 2.7.4 => /opt/X11
@dhilipsiva
dhilipsiva / requirements.txt
Last active October 13, 2015 09:47
Common python Virtualenv installs
Fabric
Django
bpython
flake8
simplejson
@dhilipsiva
dhilipsiva / installEssentials.sh
Created September 23, 2012 18:20
Install Essentials
echo "Essential Installs"
@dhilipsiva
dhilipsiva / SimpleJsonRestCall.m
Created September 21, 2012 15:55
Objective-C : A simple REST Json call using AFNetworking
-(void)actionRegister:(UIButton *)btn{
//Yes, I know you can use dictionary, but there is a bug in AFNetworking that fails to set parameters from dictionary. So I am doing it manually here.
NSString *paramStr = [NSString stringWithFormat:
@"firstname=%@"
"&lastname=%@"
"&email=%@"
"&username=%@"
"&password=%@",
firstname.text,
lastname.text,