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
Hub.listen('irc/*', function(Event) { | |
if (Event.payload.sender = "Octayn") { | |
Event.payload.message = "<Censored for stupidty>" | |
} | |
Event.next() // The new payload is sent | |
}) | |
Hub.listen('irc/*', function(Event) { | |
if (ignore_list.indexOf(Event.payload.sender) !== -1) { | |
Event.next() |
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
Hub.listen('irc/*', function(Event) { | |
Event.next() | |
Event.next( create_new_event_to_send_to_children_in_tree() ) | |
}) |
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
/* Do `fn` `times` times every `timeout` milliseconds. Add in your own error condition handling */ | |
function retry(fn, times, timeout) { | |
if (typeof fn !== 'function') { | |
return | |
} | |
times || (times = 3) // Third time's the charm | |
timeout || (timeout = 1000) | |
var trys = 0 | |
function do_retry() { | |
if (times++ < tries) { |
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
function lastElement(array) { | |
if (array.length > 0) | |
return array[array.length - 1]; | |
else | |
return null; | |
} | |
show(lastElement([1, 2, null])); |
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
$.ajax({ | |
type: "POST", | |
url: "meta-parse.php", | |
data: $('input.#url').serialize(), | |
success: function(data) { | |
var json = $.parseJSON(data); | |
var images = json.images.split(','); | |
$('#url_preview').html("<div id='message'></div>"); | |
$('#url_preview').toggle(); | |
$('#add_process_board_picker').toggle(); |
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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
typedef struct | |
{ unsigned long length | |
; char *data | |
; | |
} String; |
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
{% block css %} | |
{{ super() }} | |
<link rel="stylesheet" href="css/index.css"> | |
{% endblock %} | |
<h1>Fly them high</h1> | |
<form> | |
<input type="text" placeholder="Username" name="username"> | |
<input type="password" placeholder="Password" | |
name="password"> |
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
(python)[kb1pkl@Ulysses:hacking/python]$ python (05-27 03:21) | |
Python 2.7.3 (default, Apr 30 2012, 21:18:11) | |
[GCC 4.7.0 20120416 (Red Hat 4.7.0-2)] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import psycopg2 as pg | |
>>> conn = pg.connect('user=flyl dbname=flyl') | |
>>> c = conn.cursor() | |
>>> c.execute('INSERT INTO files (name, owner) VALUES (%s, %s) RETURNING id;', ("foo", "bar")) | |
>>> c.fetchall() | |
[(15,)] |
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
[kb1pkl@Ulysses:src/Python-3.2.3]$ time ./python /tmp/one.py (05-31 16:46) | |
./python /tmp/one.py 10.62s user 0.02s system 97% cpu 10.955 total | |
[kb1pkl@Ulysses:src/Python-3.2.3]$ time ./python /tmp/one.py (05-31 16:47) | |
./python /tmp/one.py 10.32s user 0.01s system 97% cpu 10.627 total | |
[kb1pkl@Ulysses:src/Python-3.2.3]$ time ./python /tmp/one.py (05-31 16:47) | |
./python /tmp/one.py 10.47s user 0.01s system 97% cpu 10.781 total | |
[kb1pkl@Ulysses:src/Python-3.2.3]$ time ./python /tmp/one.py (05-31 16:47) | |
./python /tmp/one.py 10.72s user 0.01s system 95% cpu 11.212 total | |
[kb1pkl@Ulysses:src/Python-3.2.3]$ time ./python /tmp/one.py (05-31 16:47) | |
./python /tmp/one.py 10.82s user 0.01s system 97% cpu 11.138 total |
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
>>> def generate(startdate, recipients, daycount, message): | |
... last_date = startdate | |
... mail = email.message_from_string(message) | |
... msg_lib = [] | |
... for i in range(0, daycount): | |
... for recep in range(len(recipients)): | |
... mail['date'] = email.utils.formatdate(time.mktime(last_date.utctimetuple())) | |
... msg_lib.append(mail) | |
... last_date = last_date + datetime.timedelta(days=1) | |
... return msg_lib |