Skip to content

Instantly share code, notes, and snippets.

View claudiopro's full-sized avatar
🐠

Claudio Procida claudiopro

🐠
View GitHub Profile
@vakila
vakila / SingleArrow.ipynb
Created April 12, 2019 07:23
Anjana Vakil, "The Universe in a Single Arrow", JSHeroes 2019
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@NielsLeenheer
NielsLeenheer / console.hex.js
Created November 26, 2017 20:22
console.hex
console.hex = (d) => console.log((Object(d).buffer instanceof ArrayBuffer ? new Uint8Array(d.buffer) :
typeof d === 'string' ? (new TextEncoder('utf-8')).encode(d) :
new Uint8ClampedArray(d)).reduce((p, c, i, a) => p + (i % 16 === 0 ? i.toString(16).padStart(6, 0) + ' ' : ' ') +
c.toString(16).padStart(2, 0) + (i === a.length - 1 || i % 16 === 15 ?
' '.repeat((15 - i % 16) * 3) + Array.from(a).splice(i - i % 16, 16).reduce((r, v) =>
r + (v > 31 && v < 127 || v > 159 ? String.fromCharCode(v) : '.'), ' ') + '\n' : ''), ''));
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 26, 2024 15:48
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@Kovah
Kovah / mysql-levenshtein.sql
Created February 22, 2017 21:29
Levenshtein function for MySQL
-- Levenshtein function
-- Source: https://openquery.com.au/blog/levenshtein-mysql-stored-function
-- Levenshtein reference: http://en.wikipedia.org/wiki/Levenshtein_distance
-- Arjen note: because the levenshtein value is encoded in a byte array, distance cannot exceed 255;
-- thus the maximum string length this implementation can handle is also limited to 255 characters.
DELIMITER $$
DROP FUNCTION IF EXISTS LEVENSHTEIN $$
CREATE FUNCTION LEVENSHTEIN(s1 VARCHAR(255) CHARACTER SET utf8, s2 VARCHAR(255) CHARACTER SET utf8)
@marcan
marcan / linux.sh
Last active December 1, 2023 15:18
Linux kernel initialization, translated to bash
#!/boot/bzImage
# Linux kernel userspace initialization code, translated to bash
# (Minus floppy disk handling, because seriously, it's 2017.)
# Not 100% accurate, but gives you a good idea of how kernel init works
# GPLv2, Copyright 2017 Hector Martin <marcan@marcan.st>
# Based on Linux 4.10-rc2.
# Note: pretend chroot is a builtin and affects the current process
# Note: kernel actually uses major/minor device numbers instead of device name
Levs-MacBook-Pro-2:~ levlaz$ gem install rails -v 4.2.3
Fetching: rack-1.6.4.gem (100%)
Successfully installed rack-1.6.4
Fetching: rack-test-0.6.3.gem (100%)
Successfully installed rack-test-0.6.3
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /Users/levlaz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.8/ext/nokogiri

Justin Searls presents, "Tenderlove: the DHH story of a boy named Gary Bernhardt"

Short abstract

Ruby has heroes. Demigods who show us how to write better code. Turns out: they're just ordinary developers! This is the story of how I discovered that by becoming Ruby-famous. In the process, I learned our hero culture is toxic.

Want to keep Ruby weird? Stop listening to us (right after my talk).

Full abstract

@htp
htp / curl-websocket.sh
Last active April 25, 2024 14:57
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@Cosmeen
Cosmeen / hide-twitter-bloat.css
Last active May 14, 2016 05:09
hide-twitter-bloat.css for Stylish extension
/*
from @rem
https://twitter.com/rem/status/729628084115247104
*/
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("twitter.com") {
div[data-component-term="user-recommendations"],
div[data-component-term="trends"],
.promoted-tweet,
flex-flow:column-reverse wrap-reverse;
justify-content:center;
align-content:space-between;