Skip to content

Instantly share code, notes, and snippets.

@novia713
novia713 / gist:11168058
Created April 22, 2014 07:06
output of commands for Pantheon
Fedora 19
leandro@montana ~ % uname -a
Linux montana 3.13.9-100.fc19.x86_64 #1 SMP Fri Apr 4 00:51:59 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
leandro@montana ~ % dig appserver.dev.3bdec629-4d95-4757-84e0-0efa3628db35.drush.in @8.8.8.8
; <<>> DiG 9.9.3-rl.13207.22-P2-RedHat-9.9.3-15.P2.fc19 <<>> appserver.dev.3bdec629-4d95-4757-84e0-0efa3628db35.drush.in @8.8.8.8
;; global options: +cmd
;; Got answer:
require 'gtk2'
require 'net/http'
require "uri"
window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
window.border_width = 10
window.title = "lndr.org.es"
window.signal_connect('delete_event') { false }
window.signal_connect('destroy') { Gtk.main_quit }
@novia713
novia713 / b2g-mkfw-dist.lean.sh
Last active August 29, 2015 14:02
make .sh for flashing FirefoxOS images (based on work of final boss Pancake (https://github.com/trufae)) [added recovery & optional userdata]
#!/bin/sh
D=peak
N=`date +%Y%m%d`
R="gp-$D-b2g-$N"
rm -rf "$R"
mkdir -p "$R/images"
cp -f out/target/product/$D/*.img "$R/images"
@novia713
novia713 / myp_nodequeue_tofront.module
Created September 25, 2014 19:00
myp_nodequeue_tofront.module
<?php
/*
* myp_nodequeue_tofront.module
*
* Copyright September 2014 Leandro <leandro.vazquez@devtopia.coop>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@novia713
novia713 / gist:3735f5b638f25650469a
Created September 23, 2015 17:11
Curry en casa
<?php
//1 | multiplicación
$m = function ($arg1) {
return function($arg2) use ($arg1){
return ($arg1 * $arg2);
};
};
// 2 x 4
cd /home/leandro/git/B2G
echo -e "\e[104mBorrando temporales .."
rm -rf objdir-gecko
rm -rf out
echo -e "\e[33mIniciando git pull .."
git pull
@novia713
novia713 / funcPHP::Decorator
Created November 19, 2015 08:39
Decorator Pattern replacement in functional PHP
<?php
$say_hello = function($name) {
return "hello, $name!\n";
};
$log_say = function ($func) {
return function ($name) use ($func){
echo "[ greeting mode enabled ]\n";
echo $func($name);
@novia713
novia713 / funcPHP::Closure
Created November 23, 2015 06:24
A counter using a closure
<?php
$create_counter = function($name) {
$counter = 0;
$increment = function ($n = 1) use (&$counter, $name) {
$counter += $n;
echo $name . " counter: " . $counter . "\n";
@novia713
novia713 / funcPHP::Closure [2]
Created November 23, 2015 08:57
A more complex (and heretic) example of using a counter with closures
<?php
$create_counter = function($name) {
$counter = 0;
$increment = function ($n = 1) use (&$counter, $name) {
$counter += $n;
echo $name . " counter: " . $counter . "\n";
@novia713
novia713 / funcPHP::Closure [3]
Created November 23, 2015 09:11
Yet another example of using a counter with closures
<?php
$create_counter = function($name) {
$counter = 0;
return function ($func = '+', $n = 1) use (&$counter, $name) {
switch ($func) {
case "+":
$counter += $n;