Skip to content

Instantly share code, notes, and snippets.

View felipecwb's full-sized avatar
🎧
🚀

Felipe Francisco felipecwb

🎧
🚀
View GitHub Profile
@felipecwb
felipecwb / fibonacci.js
Last active October 30, 2015 20:28
Fibonacci in Javascript with recursion and cache.
#!/usr/bin/env node
"use strict";
var fibonacci = function fib(n) {
if (typeof fib._cache === 'undefined') {
fib._cache = {};
}
if (fib._cache[n]) {
return fib._cache[n];
}
@felipecwb
felipecwb / infoSoapServer.php
Last active July 4, 2018 02:43
Soap Server information description.
<?php
$wsdl = isset($_GET['wsdl']) ? $_GET['wsdl'] : 'http://localhost/?wsdl';
try {
// Set the WSDL
$soap = new SoapClient($wsdl);
} catch (SoapFault $e) {
die('Unable to read the WSDL: ' . $e->getMessage());
}
@felipecwb
felipecwb / codelikeaboss
Created June 26, 2015 17:41
Code Like a Boss
#!/usr/bin/env php
<?php
if(!isset($argv[1])) {
die("\nPlease, run: codelikeaboss /your/files/dir\n");
}
system("clear");
$filetypes = array("php", "rb", "py", "c", "cpp", "java", "txt", "asp", "html", "css", "js", "ini", "md");
$dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($argv[1]));
@felipecwb
felipecwb / gitconfig.ini
Last active May 20, 2024 15:23
Some git configs
[user]
name = ...
email = ...
signingkey = ...
[alias]
yolo = "!git add -A && git commit -m \"$(curl -s https://whatthecommit.com/index.txt)\""
timeline = log --graph --branches --pretty=oneline --decorate --abbrev-commit --all
history = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all --decorate --abbrev-commit
@felipecwb
felipecwb / pre-commit
Last active August 29, 2015 14:22
My new git pre-commit hook after an outage.
#!/usr/bin/env bash
set -u
CRED="\033[0;31m"
CYELLOW="\033[1;33m"
CBLUE="\033[0;34m"
CGREEN="\033[0;32m"
CCYAN="\033[0;36m"
CDEFAULT="\033[0m"
@felipecwb
felipecwb / vimrc.vim
Last active April 17, 2019 10:12
My vimrc!
"*******************************************
"****** Felipe Francisco - @felipecwb ******
"****** https://github.com/felipecwb ******
"*******************************************
"" Vim-PLug core
"*****************************************************************************
if has('vim_starting')
set nocompatible " Be iMproved
endif
@felipecwb
felipecwb / UUID.php
Last active August 29, 2015 14:21 — forked from dahnielson/UUID.php
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
@felipecwb
felipecwb / clock_pointer.c
Last active August 29, 2015 14:20
clock pointer C using GL.
#include <windows.h>
#include <gl/gl.h>
LRESULT CALLBACK WndProc(HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam);
void EnableOpenGL(HWND hWnd, HDC *hDC, HGLRC *hRC);
void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC);
@felipecwb
felipecwb / date.compare.js
Last active August 29, 2015 14:20
Improvement of JS date compare
(function () {
"use strict";
/**
* Compare dates.
* @param {Date|String} date instance or string in W3C format
* @throws TypeError
* @return {int} 0 = equals, -1 = gt, 1 = lt
*/
Date.prototype.compare = function (date) {