Skip to content

Instantly share code, notes, and snippets.

View fczuardi's full-sized avatar

Fabricio C Zuardi fczuardi

View GitHub Profile
@fczuardi
fczuardi / echo.js
Created September 12, 2010 04:29
jerkenstein echo plugin
this.plugin = {
'name': 'echo'
,'pattern': /^\?echo (.+)$/
,'description': 'Repeat a message.'
,'example': '?echo Hello World.'
,'action': function(message) {
message.say(message.match_data[1])
}
,'url': 'http://gist.github.com/575847'
}
@fczuardi
fczuardi / colorize.js
Created September 12, 2010 05:36
jerkenstein colorize plugin
this.plugin = {
'name': 'colorize'
,'pattern': /^\?colorize (.+)$/
,'description': 'Randomly colorize the message.'
,'example': "?colorize I feel funny. Is this real life?"
,'action': function(message) {
var output = ''
for(i in message.match_data[1]){
var color_code = (Math.floor(Math.random()*14)+2).toString() //2 to 15
color_code = '\x03'+((color_code.length<2) ? ('0'+color_code) : color_code)
@fczuardi
fczuardi / double.js
Created September 12, 2010 05:38
jerkenstein double plugin
this.plugin = {
'name': 'double'
,'pattern': /^\?double (.+)$/
,'description': 'Print the same message but two times larger by repeating each character once.'
,'example': "?double Oh my God it's full on!."
,'action': function(message) {
var output = ''
for(i in message.match_data[1]){
output += message.match_data[1][i]+message.match_data[1][i]
}
@fczuardi
fczuardi / rainbow.js
Created September 12, 2010 05:39
jerkenstein rainbow plugin
this.plugin = {
'name': 'rainbow'
,'pattern': /^\?rainbow (.+)$/
,'description': 'Colorize the message like a rainbow.'
,'example': "?rainbow What does it mean?"
,'action': function(message) {
var output = ''
for(i in message.match_data[1]){
var rainbow_colors = [4, 7, 8, 3, 12, 6]
color_code = rainbow_colors[i % rainbow_colors.length]
@fczuardi
fczuardi / upper.js
Created September 12, 2010 15:04
jerkenstein upper plugin
this.plugin = {
'name': 'upper'
,'pattern': /^\?upper (.+)$/
,'description': 'Uppercase a message.'
,'example': '?upper consequences will never be the same.'
,'action': function(message) {
message.say(message.match_data[1].toUpperCase())
}
,'url': 'http://gist.github.com/576171'
}
@fczuardi
fczuardi / lln.sh
Created August 12, 2011 20:53
Trouble remembering ln -s source/target order?
#!/bin/bash
ln -s $1 $2
if [ $? -ne 0 ]; then
read -p "Try the inverse?" yn
case $yn in
[Yy]* ) `ln -s $2 $1`;
esac
fi
@fczuardi
fczuardi / jquery_queue.js
Created September 22, 2011 03:30
Jquery queue example
var filas = $({});
function queueExample(){
filas.queue('fila1', function(){console.log('1 foo');});
filas.queue('fila1', function(){console.log('1 bar');});
filas.queue('fila2', function(){console.log('2 FOO');});
filas.queue('fila2', function(){console.log('2 BAR');});
filas.queue('fila2', function(){console.log('foobar');});
console.log(filas.dequeue('fila1')); //1 foo
console.log(filas.dequeue('fila2')); //2 FOO
console.log(filas.dequeue('fila2')); //2 BAR
@fczuardi
fczuardi / get_comments.js
Created January 12, 2012 20:46
Baixa todos os comentários de uma notícia do saocarlosagora, para vc nao ter que ficar dando clique no next de 5 em 5. Cospe JSON e CSV.
// Scrapping dos comentários de noticias do site www.saocarlosagora.com.br
// codigo do script baseado no exemplo deste blog post de David Trejo
// http://blog.dtrejo.com/scraping-made-easy-with-jquery-and-selectorga
// requisitos do npm: http-agent, jsdom, jquery
//configuracao
var site = "www.saocarlosagora.com.br"
, path = "/policia/noticia/2012/01/09/25766/dig-prende-comerciante-acusado-de-estuprar-jovem-no-santa-felicia/"
, page = "?page="
@fczuardi
fczuardi / gist:2583660
Created May 3, 2012 06:10
Gaia changes for the Wifi config screen
diff --git a/apps/settings/js/wifi.js b/apps/settings/js/wifi.js
index 9ac10b0..2c6a7a0 100644
--- a/apps/settings/js/wifi.js
+++ b/apps/settings/js/wifi.js
@@ -14,7 +14,7 @@ window.addEventListener('localized', function scanWifiNetworks(evt) {
// current state
function updateState() {
- var currentNetwork = wifiManager.connectedNetwork;
+ var currentNetwork = wifiManager.connection.network;
@fczuardi
fczuardi / foca.js
Created July 17, 2012 15:55 — forked from diogoriba/foca.js
Foca no código
/* .---.
/o o\
__(= " =)__
//\'-=-'/\\
) (_
/ `"=-._
/ \ ``"=.
/ / \ \ `=..--.
___/ / \ \___ _, , `\
`-----' `""""`'-----``"""` \ \_/