Skip to content

Instantly share code, notes, and snippets.

@jethrolarson
jethrolarson / combinators.js
Last active January 15, 2018 19:36
combinators in es6
// [BCKW](https://en.wikipedia.org/wiki/B,C,K,W_system)
// compose
var B = f => g => a => f(g(a))
// flip
var C = f => a => b => f(b)(a)
// Const
var K = a => b => a
@remy
remy / _README.md
Last active January 12, 2024 11:57
requestAnimationFrame helper

raf.js

A simple script with a few niceties that allows for multiple requestAnimationFrame calls, and FPS pinning.

How it works

The script polyfills rAF if required, then overloads requestAnimationFrame and cancelAnimationFrame with a process that allows multiple frames to be queued up for rAF to run.

This is useful if there are multiple animations running on the page, you want all the callbacks to happen at once, and not on multiple rAF calls. This script is meant as a drop-in solution to that problem.

@komamitsu
komamitsu / gist:c2a5c46a22d765df5aa2
Created February 11, 2015 08:01
Fibonacci number with "with recursive" in PostgreSQL
with recursive r(a, b) as (
select 0::int, 1::int
union all
select b, a + b from r where b < 1000
)
select a from r;
a
-----
0
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@ZevEisenberg
ZevEisenberg / resetAllSimulators.sh
Last active December 23, 2024 19:57
Reset all iOS simulators with this one weird trick
osascript -e 'tell application "iOS Simulator" to quit'
osascript -e 'tell application "Simulator" to quit'
xcrun simctl erase all
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@brito
brito / dabblet.css
Last active November 25, 2024 23:41
♕β
@charset "UTF-8";
/* ♕β */
body:before { content:'I vow\A';
font-family:HelveticaNeue-CondensedBlack }
body { font:261%/1.6 HelveticaNeue; text-align:right; white-space:pre;
text-shadow:0 0 3px white;
background:hsl(333,55%,21%); color:white;
max-width:11em; margin:1em auto; padding:.3em;
outline:1px dotted }
body:after { content:'♕' }
@xem
xem / codegolf.md
Last active January 2, 2025 16:05
JS code golfing

codegolf JS

Mini projects by Maxime Euzière (xem), subzey, Martin Kleppe (aemkei), Mathieu Henri (p01), Litterallylara, Tommy Hodgins (innovati), Veu(beke), Anders Kaare, Keith Clark, Addy Osmani, bburky, rlauck, cmoreau, maettig, thiemowmde, ilesinge, adlq, solinca, xen_the,...

(For more info and other projects, visit http://xem.github.io)

(Official Slack room: http://jsgolf.club / join us on http://register.jsgolf.club)

@Kartones
Kartones / postgres-cheatsheet.md
Last active May 8, 2025 09:19
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@joyrexus
joyrexus / README.md
Last active December 13, 2024 00:46
Perl one-liners

Hi:

perl -e 'print "hello world!\n"'

A simple filter:

perl -ne 'print if /REGEX/'

Filter out blank lines (in place):