Skip to content

Instantly share code, notes, and snippets.

View filipeamoreira's full-sized avatar

Filipe A Moreira filipeamoreira

View GitHub Profile
@filipeamoreira
filipeamoreira / cloudSettings
Created February 2, 2021 21:09
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-02-02T21:09:10.034Z","extensionVersion":"v3.4.3"}

Keybase proof

I hereby claim:

  • I am filipeamoreira on github.
  • I am filipeamoreira (https://keybase.io/filipeamoreira) on keybase.
  • I have a public key ASCrJbBZumGeTTUwhSy17otptmr61fB-Sagkm2PTtIlpaAo

To claim this, I am signing this object:

@filipeamoreira
filipeamoreira / 90-min-scc.scm
Created October 16, 2018 15:01 — forked from nyuichi/90-min-scc.scm
The 90 Minute Scheme to C Compiler
#!/usr/local/Gambit-C/bin/gsi
; Copyright (C) 2004 by Marc Feeley, All Rights Reserved.
; This is the "90 minute Scheme to C compiler" presented at the
; Montreal Scheme/Lisp User Group on October 20, 2004.
; Usage with Gambit-C 4.0:
;
; % ./90-min-scc.scm test.scm
@filipeamoreira
filipeamoreira / my_renice.sh
Last active October 16, 2018 10:56 — forked from thefotios/my_renice.sh
Renice a process and all of its children recursively, passing both the nice value and the pid
#!/usr/bin/env bash
# This can be run simply by passing it the outputs from pgrep:
# my_renice 10 $(pgrep application)
#
# You may also want to use pgrep to find more complex processes based on arguments
# my_renice 10 $(pgrep -f "bash.*$name")
function my_renice(){
newnice=$1
@filipeamoreira
filipeamoreira / README.md
Created July 14, 2016 00:09 — forked from joshdover/README.md
Idiomatic React Testing Patterns

Idiomatic React Testing Patterns

Testing React components seems simple at first. Then you need to test something that isn't a pure interaction and things seem to break down. These 4 patterns should help you write readable, flexible tests for the type of component you are testing.

Setup

I recommend doing all setup in the most functional way possible. If you can avoid it, don't set variables in a beforeEach. This will help ensure tests are isolated and make things a bit easier to reason about. I use a pattern that gives great defaults for each test example but allows every example to override props when needed:

@filipeamoreira
filipeamoreira / gist:070ccc2c70f0db05aa4e
Last active August 27, 2015 21:21
how I write modules
My thoughts on writing tiny reusable modules that each do just one
thing. These notes were adapted from an email I recently sent.
***
If some component is reusable enough to be a module then the
maintenance gains are really worth the overhead of making a new
project with separate tests and docs. Splitting out a reusable
component might take 5 or 10 minutes to set up all the package
overhead but it's much easier to test and document a piece that is
require 'formula'
class BrewCask < Formula
homepage 'https://github.com/phinze/brew-cask/'
head 'http://github.com/phinze/brew-cask.git'
skip_clean :all
def install
// x-axis - time values:
time_values = [1332475200000, 1332734400000, 1332820800000, 1332907200000, 1332993600000, 1333080000000, 1333339200000, 1333425600000, 1333512000000, 1333598400000, 1333944000000, 1334030400000, 1334116800000, 1334203200000, 1334289600000, 1334548800000, 1334635200000, 1334721600000, 1334808000000, 1334894400000, 1335153600000, 1335240000000, 1335326400000, 1335412800000, 1335499200000, 1335758400000, 1335844800000, 1335931200000, 1336017600000, 1336104000000, 1336363200000, 1336449600000, 1336536000000, 1336622400000, 1336708800000, 1336968000000, 1337054400000, 1337140800000, 1337227200000, 1337313600000, 1337572800000, 1337659200000, 1337745600000, 1337832000000, 1337918400000, 1338264000000, 1338350400000, 1338436800000, 1338523200000, 1338782400000, 1338868800000, 1338955200000, 1339041600000, 1339128000000, 1339387200000, 1339473600000, 1339560000000, 1339646400000, 1339732800000, 1339992000000, 1340078400000, 1340164800000, 1340251200000, 1340337600000, 1340596800000, 134068320
@filipeamoreira
filipeamoreira / jquery.ba-tinypubsub.js
Created May 7, 2012 21:06 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
@filipeamoreira
filipeamoreira / uri.js
Created May 7, 2012 17:08 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"