Skip to content

Instantly share code, notes, and snippets.

View bianchimro's full-sized avatar
🤡

Mauro Bianchi bianchimro

🤡
View GitHub Profile
@bianchimro
bianchimro / gist:11396501
Created April 29, 2014 10:38
Restangular tastypie configuration with cross origin
(function () {
'use strict';
var angularApp = angular.module("angularApp", ['restangular']);
angularApp.config(['$httpProvider', function($httpProvider){
$httpProvider.defaults.useXDomain = true;
$httpProvider.defaults.withCredentials = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
@bianchimro
bianchimro / gist:d032365a360bab7a1f8d
Last active August 29, 2015 14:00
django config in template
<script>
var djangoConfig = {
staticUrl : '{{STATIC_URL}}'
};
var getStaticPath = function(url){
return djangoConfig.staticUrl + url;
};
</script>

DataURI.py

Data URI manipulation made easy.

This isn't very robust, and will reject a number of valid data URIs. However, it meets the most useful case: a mimetype, a charset, and the base64 flag.

Parsing

@bianchimro
bianchimro / ssh_keys_upload.sh
Created October 17, 2014 08:53
SSH KEYS UPLOAD
#!/bin/sh
KEY="$HOME/.ssh/id_rsa.pub"
if [ ! -f ~/.ssh/id_rsa.pub ];then
echo "private key not found at $KEY"
echo "* please create it with "ssh-keygen -t dsa" *"
echo "* to login to the remote host without a password, don't give the key you create with ssh-keygen a password! *"
exit
fi
@bianchimro
bianchimro / nginx.conf
Last active August 29, 2015 14:11 — forked from widoyo/nginx.conf
Deploy Django-Nginx-uwsgi pada web faction
referensi: http://community.webfaction.com/questions/10242/installing-nginx-uwsgi
APPNAME="tracker"
/home/narayana/webapps/tracker
bin
start
stop
@bianchimro
bianchimro / index.html
Last active August 29, 2015 14:18
manually bootstrapping angular app with cordova
<script>
// manually bootstrapping app in order to have cordova (And plugins loaded) ready to go
// (remove the "ng-app" attribute from your markup)
angular.element(document).ready(function() {
if (window.cordova) {
document.addEventListener('deviceready', function() {
angular.bootstrap(document.body, ['starter']);
}, false);
} else {
angular.bootstrap(document.body, ['starter']);
#museums{
marker-fill: red;
}
@bianchimro
bianchimro / gist:8a7a41cda6d43dd39434
Created August 13, 2015 12:09
imagemagik resize batch with padding
mogrify -path getjar/ -resize 480x -gravity center -background black -extent 480x800 -format png amazon/*.png
@bianchimro
bianchimro / POSTGRES DB SIZE
Created July 16, 2010 11:37
Query PostgreSQL db for table sizes
SELECT pg_database.datname,
pg_size_pretty(pg_database_size(pg_database.datname)) AS size
FROM pg_database;