Skip to content

Instantly share code, notes, and snippets.

/**
* 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();
@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
# 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.
@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
@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.

@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
@brito
brito / city-of-la-wcp-template.jspx
Created September 22, 2015 19:30
Oracle WebCenter Portal Template Example
<?xml version='1.0' encoding='UTF-8'?>
<!--
City of Los Angeles Template
July 7, 2015
Oracle WebCenter Portal Template
-->
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:h="http://java.sun.com/jsf/html"
@ppseprus
ppseprus / entropy-in-short.js
Last active August 22, 2024 10:13 — forked from jabney/entropy.js
Javascript implementation of a Shannon entropy calculation in bits per symbol
// Shannon entropy
const entropy = str => {
return [...new Set(str)]
.map(chr => {
return str.match(new RegExp(chr, 'g')).length;
})
.reduce((sum, frequency) => {
let p = frequency / str.length;
return sum + p * Math.log2(1 / p);
}, 0);
@brito
brito / data.url.html
Created April 26, 2017 21:47
Data URL responsive iframe micro-snippet
data:text/html,<body style="padding-bottom:56.25%;background:#000;position:relative;height:0;overflow:hidden;margin:0"><iframe style="position:absolute;top:0;left:0;width:100%;height:100%;border:0" src="https://www.youtube.com/embed/CKvMmtclUBA" allowfullscreen></iframe>
@brito
brito / example.html
Created April 26, 2017 21:48
Micro redirect (for saving link as local file)
<meta http-equiv=refresh content="0;URL=https://leanpub.com/javascriptallongesix/read">