Skip to content

Instantly share code, notes, and snippets.

View hussani's full-sized avatar

Hussani Oliveira hussani

View GitHub Profile
@hussani
hussani / keybase.md
Created February 24, 2025 01:31
keybase proof

Keybase proof

I hereby claim:

  • I am hussani on github.
  • I am hussani (https://keybase.io/hussani) on keybase.
  • I have a public key ASAWSMZ1k72-3F8OesscP6kskjgD6npjUv6Ix7JYEqWHBwo

To claim this, I am signing this object:

@hussani
hussani / ca.md
Created February 22, 2018 21:15 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@hussani
hussani / cnpjValidator.php
Created June 10, 2015 18:53
PHP function to validade a CNPJ
<?php
function validateCnpj($cnpj)
{
$cnpj = preg_replace('/[^0-9]/', '', (string) $cnpj);
if (strlen($cnpj) != 14) {
return false;
}
for ($i = 0, $j = 5, $sum = 0; $i < 12; $i++) {
systems({
"my-app": {
image: {"docker": "azukiapp/php-fpm"},
provision: [
// "composer install",
],
workdir: "/azk/#{manifest.dir}",
mounts: {
'/azk/#{manifest.dir}': path("."),
'/etc/nginx/sites-enabled/nginx_public.conf': path("./nginx_public.conf")
@hussani
hussani / gist:a652756b4842e33f680c
Last active August 29, 2015 14:16 — forked from jimbojsb/gist:1630790
highlight output

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
else
puts "_Info_: Plugin '''vagrant-cachier''' is not installed."
@hussani
hussani / SampleProduct.php
Created February 26, 2014 21:02
PHPUnit error on mock expecting interface
class SampleProduct
{
/* implementation */
public function setBougthBy(UserInterface $user)
{
$this->bougthBy = $user;
}
}
@hussani
hussani / youtube.js
Created July 30, 2013 19:40
Get Youtube videos and show into modal box
/*
Uses http://github.com/kylefox/jquery-modal to open video into modal box
*/
var playlistId, key, maxResults, nextPageToken, prevPageToken;
playlistId = "playlistID";
key = "apiConsumerKey";
maxResults = 50;
@hussani
hussani / posts.php
Created July 24, 2013 22:13
Simple Blog system with Respect Relational
<?php
use Respect\Relational\Mapper;
use Respect\Relational\Sql;
// Create instance of Mapper
$mapper = new Mapper(new PDO('mysql:host=127.0.0.1;port=3306;dbname=blog','root','root'));
// Persisting data

Awesome PHP

A list of amazingly awesome PHP libraries, resources and shiny things.

Composer