This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Lock { | |
private $mc; | |
private $key; | |
function __construct($key=null, $expire=300) { | |
$this->mc = MemoryCache::getInstance($expire); | |
$this->key = is_null($key)? "mv_lock_". rand(1000, 9999): $key; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Original: https://github.com/greggoryhz/MooTools-onHashChange-Event | |
Example: | |
window.addEvent('hashchange', function(hash) { console.log(hash); }); | |
*/ | |
Element.Events.hashchange = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from python_redis_pubsub import TestPubsub | |
import time | |
if __name__ == "__main__": | |
test = TestPubsub() | |
print test.publish('test01', time.time()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 1. put this file in a cron job | |
# 2. then, setup your desktop preferences to use the $BACKDROP image list | |
DESKTOPS=2 | |
SAVE_TO="/home/salvarez/tmp/wp" | |
BACKDROP="/home/salvarez/tmp/xfce4-backdrop.list" | |
export DISPLAY=:0.0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ConfigParser { | |
private $_raw; | |
private $_ini; | |
private $_allow_no_value=false; | |
function __construct($allow_no_value=false) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Foo { | |
var $foo = 'bar'; | |
var $true = true; | |
var $false = false; | |
var $bar = array(1,2,3,1.23456789); | |
var $ass = array("life" => 42, "foo" => "bar"); | |
function __set($name, $value) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
cd proyecto | |
# paso los originales a utf8 en archivos .utf8 | |
for a in $(find . -name "*.php"); do iconv -f iso-8859-1 -t utf-8 <"$a" >"$a.utf8" ; done | |
# muevo los originales a .iso | |
for a in $(find . -name "*.php"); do mv "$a" "$a.iso" ; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Sergio Álvarez Muñoz | |
xergio@gmail.com | |
https://sergio.am | |
Basado en el sistema de templates de Django. | |
Snipper adaptado de http://effbot.org/zone/django-simple-template.htm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# git clone https://github.com/ioquatix/rubydns | |
require 'rubygems' | |
require 'rubydns' | |
$R = Resolv::DNS.new | |
$H = Resolv::Hosts.new | |
Name = Resolv::DNS::Name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://github.com/rg3/youtube-dl/ | |
$playlist_id = "PL35E63D54FF7AAFC4"; | |
//$playlist_id = "PL91D82848DC945315"; | |
$max_results = 10; | |
$start_index = 1; | |
do { |
OlderNewer