Skip to content

Instantly share code, notes, and snippets.

View filipesperandio's full-sized avatar

Filipe Esperandio (Pippo) filipesperandio

  • CodeClimate
  • porto alegre, brazil
  • 13:57 (UTC -03:00)
View GitHub Profile
#!/usr/bin/env bash
echo "Installing docker"
wget -qO- https://get.docker.com/ | sudo sh
sudo usermod -aG docker filipesperandio
echo "Installing SMB/CIFS and local net discovery"
sudo apt-get install cifs-utils pyNeighborhood
echo "Mounting NAS"
@filipesperandio
filipesperandio / allow_ssh.sh
Last active August 29, 2015 14:21
Allow for non-password ssh
#!/usr/bin/env bash
SERVER=$1
ssh $SERVER mkdir -p .ssh
cat ~/.ssh/id_rsa.pub | ssh $SERVER "cat >> .ssh/authorized_keys"
@filipesperandio
filipesperandio / keybase.md
Last active August 29, 2015 14:27
keybase.md

Keybase proof

I hereby claim:

  • I am filipesperandio on github.
  • I am filipesperandio (https://keybase.io/filipesperandio) on keybase.
  • I have a public key whose fingerprint is 4DE3 6277 76E2 33AF 5077 3663 AF5F 43FE A9DB D87C

To claim this, I am signing this object:

@filipesperandio
filipesperandio / angular_directive_declaration.js
Last active December 18, 2015 19:39
Basic Angular Directive Definition
var directiveFunction = function() {
return function(scope, element, att) {
console.log(scope); //scope is the real angular scope related to that DOM element
console.log(element); //element is a jquery like object and has a subset of jquery functions -> http://docs.angularjs.org/api/angular.element
console.log(att); //att has the attributes you pass on the directive
console.log(att.something); // fulano
}
};
module.directive("something", directiveFunction );
@filipesperandio
filipesperandio / rake.rb
Created August 5, 2013 11:56
Rake routes for a Sinatra App
require "sinatra/activerecord/rake"
require "./your_app"
task :routes do
["GET", "POST", "PUT", "DELETE"].each do |verb|
routes = Sinatra::Application.routes[verb] || []
routes.as_json.flatten.each do |params|
puts params["route_name"] if params.is_a? Hash
end
end
private void shceduleSomething() {
final Handler handler = new Handler();
Timer timer = new Timer();
TimerTask doAsynchronousTask = new TimerTask() {
@Override
public void run() {
handler.post(new Runnable() {
public void run() {
doSomething();
}
@filipesperandio
filipesperandio / flatten.js
Last active September 17, 2016 18:55
Flatten array
function arrayEquals(actual, expected) {
return actual.every(function(element, i) {
if (Array.isArray(element)) {
return arrayEquals(element, expected[i]);
}
return element === expected[i];
})
}
function flatten (arr) {
@filipesperandio
filipesperandio / index.html
Last active September 17, 2016 20:37 — forked from anonymous/index.html
Flex Box Spike | http://jsbin.com/beluce
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
ol, li {
margin: 0;
padding: 0;
}
@filipesperandio
filipesperandio / childFromParent.groovy
Last active September 17, 2016 20:47
Groovy construct child from parent
class Parent {
def fieldA
Map asMap() {
this.class.declaredFields.findAll { !it.synthetic }.collectEntries {
["${it.name}": this[it.name]]
}
}
}
@filipesperandio
filipesperandio / RxAndroid_Test.java
Last active October 11, 2016 14:50
Android Gists
static {
RxAndroidPlugins rxAndroidPlugins = RxAndroidPlugins.getInstance();
rxAndroidPlugins.reset();
rxAndroidPlugins.registerSchedulersHook(new RxAndroidSchedulersHook() {
@Override
public Scheduler getMainThreadScheduler() {
return Schedulers.immediate();
}
});
}