This file contains hidden or 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
# -*- coding: utf-8 -*- | |
# <bash_profile - for mac> | |
# Copyright (C) <2011> Gabriel Falcão <[email protected]> | |
# | |
# Permission is hereby granted, free of charge, to any person | |
# obtaining a copy of this software and associated documentation | |
# files (the "Software"), to deal in the Software without | |
# restriction, including without limitation the rights to use, | |
# copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the |
This file contains hidden or 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
app.get('/robots.txt', function(req, res){ | |
var rules = [ | |
'User-agent: *', | |
'Disallow: /' | |
].join('\n'); | |
res.send(rules, { 'Content-Type': 'text/plain' }, 200); | |
}); |
This file contains hidden or 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
xhr.upload | |
[4/24/12 1:31:47 AM] Maxwell Dayvson: var fd = new FormData(); | |
var file = this.input.files[0]; | |
fd.append(this.input.name, file); | |
var xhr = new XMLHttpRequest(); | |
xhr.upload.addEventListener("progress", function(evt){}); | |
xhr.upload.addEventListener("load", function(evt){}); | |
xhr.upload.addEventListener("error", function(evt){}); | |
xhr.upload.addEventListener("abort", function(evt){}); | |
xhr.open("POST", "/url"); |
This file contains hidden or 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
import ast | |
def get_safe_function(code): | |
expression = ast.parse(code).body[0] | |
if expression.value.__class__.__name__ == 'Lambda': | |
return eval(code) | |
else: | |
logger.warning("Got an unsafe code: %s", repr(code)) |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
float ask_user_for_dollars(char *question){ | |
char *string = malloc(13); | |
float dollars; | |
printf("%s\n", question); | |
scanf("%s", string); |
This file contains hidden or 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 <assert.h> | |
#include "converter.c" | |
void test_works_with_1_character(){ | |
/* prepare the test */ | |
char *expected = "one dollar"; | |
char *given = convert_to_textual(1); | |
/* execute the test */ |
This file contains hidden or 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
0 = Success | |
1 = Operation not permitted | |
2 = No such file or directory | |
3 = No such process | |
4 = Interrupted system call | |
5 = Input/output error | |
6 = No such device or address | |
7 = Argument list too long | |
8 = Exec format error |
This file contains hidden or 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
compile qt | |
./configure -prefix /usr/local/Cellar/qt/4.8.3 -system-libpng -system-zlib -confirm-license -opensource -cocoa -fast -L/opt/X11/lib -I/opt/X11/include -no-qt3support -nomake demos -nomake examples -release |
This file contains hidden or 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
SERVICES="mysql redis elasticsearch mongo" | |
SERVICE_LOAD_mysql="mysqld" | |
SERVICE_LOAD_mongo="mongod" | |
SERVICE_LOAD_redis="redis-server /usr/local/etc/redis.conf" | |
SERVICE_LOAD_elasticsearch="elasticsearch -f -D es.config=/usr/local/opt/elasticsearch/config/elasticsearch.yml" | |
daemonize-service (){ | |
name=$1 | |
shift |
This file contains hidden or 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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(100); |