Skip to content

Instantly share code, notes, and snippets.

View igorsantos07's full-sized avatar
😄
Happy at work :)

Igor Santos igorsantos07

😄
Happy at work :)
View GitHub Profile
<?php
use Luracast\Restler\Restler;
use Luracast\Restler\Explorer;
require __DIR__ . '/../vendor/autoload.php';
$r = new Restler();
@igorsantos07
igorsantos07 / 1 General info.md
Last active April 22, 2016 17:48
CSS tools on React

Main comparison

  1. Traditional CSS

  • Simple approach, known API
  • we would have to deal with namespace conflicts
  • leverages browser caching, storing the entire app style in the first load and reducing following reloads
  1. Style-based implementations
#!/usr/bin/env php
<?php
define('ROOT', dirname(dirname(__DIR__)));
chdir(ROOT);
$pending_migrations = (int)trim(`./artisan migrate:status --no-ansi | grep -c '| N'`);
echo "===> Pending migrations: $pending_migrations";
if ($pending_migrations) {
$migrations = array_filter(explode("\n", `./artisan migrate:status --no-ansi | grep '| N'`));
$migrations = array_map(function($line) { return ' > '.trim($line, " |N\t"); }, $migrations);
@igorsantos07
igorsantos07 / proportionalPieces.js
Created June 6, 2018 04:19
Calculates unequal but proportional pieces of 100%
//used this through trial and error to find the correct proportions for a progress bar where one element is 10%, with 5 pieces
//based on https://stackoverflow.com/a/40094266/102960
function proportionalPieces(proportion, size) {
const pieces = [1]
for (let i = 1; i < size; i++) {
pieces[i] = pieces[i-1] * proportion
}
const sum = pieces.reduce((acc, piece) => acc + piece)
@igorsantos07
igorsantos07 / README.md
Last active January 13, 2024 00:55
USA+Canada subdivisions

A bunch of GeoJSON files for north-american uses

Canada

Plain and simple, copied from https://data.opendatasoft.com.

USA

Plain and simple, copied from https://data.opendatasoft.com. This includes the 50 states, DC, and the 5 territories.

Canada-USA

Mixed the two files above, simplifying extra fields by focusing on subdivision names and abbreviations only.

@igorsantos07
igorsantos07 / main.py
Last active March 13, 2024 23:57
stderr doesn't get captured when stdout=sys.stdout
#!/usr/bin/env python3
#############################################################################
# Reproducible example for https://stackoverflow.com/q/78152055/102960
# The objective is to see the presentation line, the prompt line, be able to
# answer it, and then have stderr captured and omitted from normal console
# output.
# Run THIS script from CLI, not script.py
#############################################################################
import shlex
import subprocess