Skip to content

Instantly share code, notes, and snippets.

View fntneves's full-sized avatar

Francisco Neves fntneves

View GitHub Profile
@fntneves
fntneves / sloth.zsh-theme
Last active November 26, 2020 22:52
sloth.zsh-theme
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
#
@fntneves
fntneves / com.googlecode.iterm2.plist
Created November 26, 2020 22:03
iTerm2 Preferences
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AlternateMouseScroll</key>
<true/>
<key>AppleAntiAliasingThreshold</key>
<integer>1</integer>
<key>ApplePressAndHoldEnabled</key>
<false/>
@fntneves
fntneves / skip_utf8_bom.php
Created March 15, 2020 22:56
Skip UTF8 BOM bytes
<?php
function skipUtf8Bom(\SplFileObject $file)
{
if ($file->fread(3) !== pack('CCC', 0xEF, 0xBB, 0xBF)) {
$file->rewind();
}
}
@fntneves
fntneves / .php_cs
Created March 24, 2019 12:24
Configuration for PHP-CS
<?php
$header = <<<'EOF'
/*
* This file is part of the <project> project.
*
* (c) Author <email>
*/
EOF;
@fntneves
fntneves / producer-consumer.py
Last active April 22, 2018 23:42
Producer-[Consumer/Producer]-Consumer example with graceful shutdown
from multiprocessing import Event, JoinableQueue, Process, current_process, active_children
import Queue
import time
import signal
import os
def ignore(signun, frame):
pass
def producer(output_queue):
### Keybase proof
I hereby claim:
* I am fntneves on github.
* I am fntneves (https://keybase.io/fntneves) on keybase.
* I have a public key whose fingerprint is 9C02 4AE0 7D51 101C E7AD FAF2 B9A7 4CC4 6122 2F73
To claim this, I am signing this object:
@fntneves
fntneves / TestCase.php
Last active March 31, 2018 23:25
A TestCase class that disables database events by temporarily replacing the EventDispatcher that has no listeners
<?php
namespace Tests\Feature;
use Tests\TestCase as BaseTestCase;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Foundation\Testing\RefreshDatabase;
abstract class TestCase extends BaseTestCase
{
@fntneves
fntneves / Class.js
Created October 13, 2017 13:24
Class example with private methods.
const privateMethod = Symbol('privateMethod');
export default class Clazz {
constructor() {
//
}
doIt() {
//
}
export default class FileReaderPromise {
constructor(file) {
this.file = file;
}
readAsText() {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = e => resolve(e.target.result);
reader.onerror = e => reject(new Error(`Error reading ${this.file.name}: ${e.target.result}`));
@fntneves
fntneves / .php_cs
Last active January 9, 2020 00:24
Laravel Coding Standards
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => ['align_equals' => false],
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,