Skip to content

Instantly share code, notes, and snippets.

View demian85's full-sized avatar
🏠
Hacking from home

Demián Rodriguez demian85

🏠
Hacking from home
View GitHub Profile
@demian85
demian85 / tweeter-hack.js
Created March 25, 2011 23:03
Hack para ver tweets en orden cronológico. Agregarlo como bookmarklet...
javascript:$('.stream,.stream-items').css({display:'-webkit-box',webkitBoxOrient:'vertical',webkitBoxDirection:'reverse'});document.onscroll=function(e){e.stopPropagation()}
demian@demian-notebook:~/www/projects/test/application/scripts$ npm ls
npm WARN Logger.js * Unmet dependency in /home/demian/www/projects/test/application/scripts
npm WARN LogsAlert.js * Unmet dependency in /home/demian/www/projects/test/application/scripts
npm WARN Queue.js * Unmet dependency in /home/demian/www/projects/test/application/scripts
npm WARN TStream.js * Unmet dependency in /home/demian/www/projects/test/application/scripts
npm WARN colored.js * Unmet dependency in /home/demian/www/projects/test/application/scripts
npm WARN crawler.js * Unmet dependency in /home/demian/www/projects/test/application/scripts
npm WARN extensions.js * Unmet dependency in /home/demian/www/projects/test/application/scripts
npm WARN mootools-core-1.3.js * Unmet dependency in /home/demian/www/projects/test/application/scripts
npm WARN parser.js * Unmet dependency in /home/demian/www/projects/test/application/scripts
@demian85
demian85 / gist:991389
Created May 25, 2011 17:10
request timeout test
process.env.TZ = 'UTC';
var util = require('util'),
fs = require('fs'),
request = require('request'),
args = require('argsparser').parse();
for (var count = 0; count < 10; count++) {
(function(i) {
var uri = 'http://www.google.com/?i=' + i;
var util = require('util'),
http = require('http'),
connect = require('connect'),
express = require('express');
var app = express.createServer();
app.configure(function(){
app.use(express.bodyParser());
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
@demian85
demian85 / gist:1135081
Created August 9, 2011 20:16
GDD2011 test #3
var util = require('util'),
fs = require('fs');
// textos...
var txta = fs.readFileSync('a.txt', 'utf8');
var txtb = fs.readFileSync('b.txt', 'utf8');
var words = txtb.trim().split(/\s+/);
var uniq = [];
words.forEach(function(w) {
@demian85
demian85 / magic.js
Created August 31, 2011 17:51
node http proxy
var httpProxy = require('http-proxy'),
http = require('http');
var options = {
router: {
'.*?\.demian.magic.com': '127.0.0.1:8000'
}
};
var proxyServer = httpProxy.createServer(options);
proxyServer.listen(80);
/**
* Create HTML anchor tags replacing URL's
*
* @param string $input
* @param string $target anchor target attribute
* @return string
*/
function parseLinks($input, $target = '_blank') {
return preg_replace('#(^|\s)((?:http|https|ftp)://.+?\.[a-z]{2,3}.*?)(\s|$)#i', '$1<a href="$2" target="' . $target . '">$2</a>$3', $input);
}
@demian85
demian85 / numberFormat.js
Created July 12, 2012 16:06
JS number format func
function numberFormat(number, dec, dsep, tsep) {
if (isNaN(number)) return "";
number = number.toFixed(dec || 0);
var pindex = number.indexOf('.'), fnums, decimals, parts = [];
if (pindex > -1) {
fnums = number.substring(0, pindex).split('');
decimals = (dsep || '.') + number.substr(pindex+1);
}
else {
fnums = number.split('');
@demian85
demian85 / sucks.php
Created October 18, 2012 14:18
handlebars.js con PHP...
<?
$db = DB::getConnection();
$sql = "SELECT * FROM Projects ORDER BY name";
$data = $db->query($sql)->fetchAll();
array_walk($data, function(&$v) {
$v['enabled'] = (int)$v['enabled'];
$v['visible'] = (int)$v['visible'];
});
Response::json($data);
?>
// ==UserScript==
// @name Colorful Teg
// @version 1.0
// @match *teg.avature.net*
// @run-at document-end
// ==/UserScript==
[
'.analysis_functional > td {background-color: rgba(255, 80, 168, 0.45) !important; }',
'.testing > td { background-color: rgba(255, 255, 176, 0.45) !important; }',