Skip to content

Instantly share code, notes, and snippets.

View lucasmezencio's full-sized avatar
:bowtie:
Neeeeeeeeerd

Lucas Mezêncio lucasmezencio

:bowtie:
Neeeeeeeeerd
View GitHub Profile
@fwielstra
fwielstra / api.js
Created June 14, 2011 14:46
An example NodeJS / Mongoose / Express application based on their respective tutorials
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
@cdown
cdown / gist:1163649
Last active June 16, 2024 12:47
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in
@brtriver
brtriver / BasicAuthControllerProvider.php
Created February 4, 2012 20:36
Simple Basic Auth Controller for Silex.
<?php
namespace Silex\Provider;
use Silex\Application;
use Silex\SilexEvents;
use Silex\ControllerProviderInterface;
use Silex\ControllerCollection;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@oodavid
oodavid / README.md
Last active June 12, 2024 00:28 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@lucasmezencio
lucasmezencio / problema_c.cpp
Last active May 22, 2019 11:58
Problema C
/**
* Make this program to print 13 making changes ONLY the body of the "function" function
* You are NOT ALLOWED to change NOTHING in the "main" function
*/
void function() {
/* EDIT ONLY HERE */
}
int main() {
@lucasmezencio
lucasmezencio / overthinking.txt
Last active February 25, 2019 13:53
Overthinking
This problem can be solved by pre-school children in
five to ten minutes, by programmers in a hour and by
people with higher education... well, check it yourself!
8809 = 6 5555 = 0
7111 = 0 8193 = 3
2172 = 0 8096 = 5
6666 = 4 1012 = 1
1111 = 0 7777 = 0
3213 = 0 9999 = 4
@lucasmezencio
lucasmezencio / var_dump_netbeans.php
Last active October 5, 2015 21:48
PHP var_dump snippets
// PHP var_dump snippet for NetBeans
echo '<pre>';
die(var_dump(${VARIABLE variableFromPreviousAssignment default="$variable"}));
@lucasmezencio
lucasmezencio / gist:3314588
Created August 10, 2012 14:23
Remove all SVN folders recursively from a folder
find . -name ".svn" -exec rm -rf {} \;
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@codeswimmer
codeswimmer / gotham.py
Created August 24, 2012 20:13 — forked from jart/gotham.py
Lorem Gotham w/ Rhyming
r"""
gotham
~~~~~~
Gothic Poetry Generator
"""
import marshal