Skip to content

Instantly share code, notes, and snippets.

View fibo's full-sized avatar
🎼
Working from everywhere

Gianluca Casati fibo

🎼
Working from everywhere
View GitHub Profile
@bllmo
bllmo / swift-fundamental.swift
Created November 2, 2016 09:00
Swift Fundamental
/*
* # Hello World
*
* It is common to start any tutorial for a new language with the Hello World
* example so we'll start out by showing how easy this is to do in Swift:
*/
print("Hello World")
/*
@umidjons
umidjons / client-server-post-request-ex-in-pure-node.md
Created August 17, 2016 09:29
Client/Server post request example in pure Node.js

Client/Server POST request example in pure Node.js

File server.js:

var http = require('http');
var querystring = require('querystring');

var server = http.createServer().listen(3000);

server.on('request', function (req, res) {
@fibo
fibo / README.md
Last active December 3, 2020 13:59
Flatten an array of arbitrarily nested arrays of values into a flat array of values. e.g. [[1,2,[3]],4] -> [1,2,3,4].

flattenArray

Flatten an array of arbitrarily nested arrays of values into a flat array of values

Usage

// Both CommonJS and ES6 import syntaxes are supported
// import flattenArray from './flattenArray'
const flattenArray = require('./flattenArray')
@steveruizok
steveruizok / Resizer.tsx
Created June 19, 2019 08:38
A Framer X Code Component that will resize to fit its text content.
import * as React from "react"
import {
Frame,
FrameProps,
useMotionValue,
addPropertyControls,
ControlType,
} from "framer"
type Props = FrameProps & {
@jbolila
jbolila / .ctags
Created November 22, 2013 10:48
ctags for Modern Perl
--recurse=yes
--tag-relative=yes
--exclude=.git
--langmap=perl:+.pod
--regex-perl=/package[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/p,package,packages/
--regex-perl=/with[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/w,role,roles/
--regex-perl=/extends[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/e,extends/
--regex-perl=/use[ \t]+base[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/e,extends/
--regex-perl=/use[ \t]+parent[ \t]+['"]*([A-Za-z][A-Za-z0-9:]+)['" \t]*;/\1/e,extends/
@dannguyen
dannguyen / faa-333-pdf-gathering.md
Last active June 19, 2021 13:18
Using wget + grep to explore inconveniently organized federal data (FAA Section 333 Exemptions)

if !database: wget + grep

The Federal Aviation Administration is posting PDFs of the Section 333 exemptions that it grants, i.e. the exemptions for operators who want to fly drones commercially before the FAA finishes its rulemaking. A journalist wanted to look for exemptions granted to operators in a given U.S. state. But the FAA doesn't appear to have an easy-to-read data file to use and doesn't otherwise list exemptions by location of operator.

However, since their exemptions page is just one giant HTML table for listing the PDFs, we can just use wget to fetch all the PDFs, run pdftotext on each file, and then [grep](https://medium.com/@rualthanzauva/grep-was-a-private-command-of-m

@jasongonzales23
jasongonzales23 / .vimrc
Created October 8, 2017 21:49
Vim console.log shortcut
" Console log from insert mode; Puts focus inside parentheses
imap cll console.log()<Esc><S-f>(a
" Console log from visual mode on next line, puts visual selection inside parentheses
vmap cll yocll<Esc>p
" Console log from normal mode, inserted on next line with word your on inside parentheses
nmap cll yiwocll<Esc>p
@faisalman
faisalman / baseConverter.js
Last active January 11, 2023 14:43
Convert From/To Binary/Decimal/Hexadecimal in JavaScript
/**
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript
* https://gist.github.com/faisalman
*
* Copyright 2012-2015, Faisalman <fyzlman@gmail.com>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
(function(){
@ChrisWills
ChrisWills / .screenrc-main-example
Created November 3, 2011 17:50
A nice default screenrc
# GNU Screen - main configuration file
# All other .screenrc files will source this file to inherit settings.
# Author: Christian Wills - cwills.sys@gmail.com
# Allow bold colors - necessary for some reason
attrcolor b ".I"
# Tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}