Skip to content

Instantly share code, notes, and snippets.

View geotheory's full-sized avatar

Robin Edwards geotheory

View GitHub Profile
A=140,E=11,E&F=28,C=57,C&F=179,C&F&A=259,C&F&A&E=69,C&F&E=54,S&F=10,S&F&C=22,S&F&C&A=26,S&F&C&A&D=18,S&F&C&A&E=17,S&F&C&A&E&D=23,S&F&C&E=11,S&F&C&E&D=8,S&F&C&D=7,C&S=1,S=5,F&D=43,F&D&A=64,F&D&A&C=41,F&D&A&C&E=50,F&D&A&E=17,F&D&C&E=17,F&D&E=12,F&C&D=31,C&D=7,D=12,A&F=281,E&F&A=46,F=198
@qykong
qykong / snowflake.R
Last active November 6, 2021 00:28
decomposing Twitter ID to timestamp, datacenter_id, worker_id, and sequence_id in R
library(bit64)
twepoch <- as.integer64('1288834974657')
base <- as.integer64(2)
datacenter_id_bits <- 5
worker_id_bits <- 5
sequence_id_bits <- 12
max_datacenter_id <- 1 * base^datacenter_id_bits
max_worker_id <- 1 * base^worker_id_bits
max_sequence_id <- 1 * base^sequence_id_bits
@geotheory
geotheory / url_requests.js
Created January 31, 2018 11:16 — forked from anaynayak/url_requests.js
phantom.js script to log all http requests from a page
var page = require('webpage').create(),
system = require('system'),
address;
if (system.args.length === 1) {
console.log('Usage: phantomjs url_requests.js http://some.url.com');
phantom.exit(1);
} else {
address = system.args[1];
var logUrl = function (req) {
@eduncan911
eduncan911 / Revert-Gist.md
Last active July 20, 2023 09:41
Revert Gist Commits

Revert / Undo a Gist Commit

It was not exactly obvious. Here's how to revert a Gist commit!

Checkout the gist like a normal git repo:

# replace the Gist ID with your own
git clone git@github.com:cc13e0fcf2c348cc126f918e4a3917eb.git

Treat it like a normal repo. Edit, force push, etc.

@ximus
ximus / ubilinux-flashall-osx.diff
Created March 16, 2015 03:24
get flashall.sh to work on osx
--- flashall.sh
+++ (clipboard)
@@ -220,15 +220,14 @@
flash-command --alt u-boot-env0 -D "${VARIANT_FILE}"
echo "Flashing U-Boot Environment Backup"
- flash-command --alt u-boot-env1 -D "${VARIANT_FILE}" -R
+ flash-command --alt u-boot-env1 -D "${VARIANT_FILE}"
echo "Rebooting to apply partition changes"
- dfu-wait no-prompt
@Pakillo
Pakillo / ggplot_resources.md
Last active October 17, 2022 04:38
ggplot2: tutorials and complementary packages
@narrowdesign
narrowdesign / gist:361eb935a42daab5cf4c
Last active February 21, 2021 22:07
Touch events that behave exactly like mouse events while mouse dragging or touch moving.
// vars to keep track of the "mouse" during touchmove
var mouseX;
var mouseY;
// create the custom events so you can dispatch them later
var touchover = new Event("touchover");
var touchout = new Event("touchout");
var touchup = new Event("touchup");
var element = document.getElementById("dropTargetDivName");
@quchen
quchen / trolling_haskell
Last active February 24, 2024 01:30
Trolling #haskell
13:15 <xQuasar> | HASKELL IS FOR FUCKIN FAGGOTS. YOU'RE ALL A BUNCH OF
| FUCKIN PUSSIES
13:15 <xQuasar> | JAVASCRIPT FOR LIFE FAGS
13:16 <luite> | hello
13:16 <ChongLi> | somebody has a mental illness!
13:16 <merijn> | Wow...I suddenly see the error of my ways and feel
| compelled to write Node.js!
13:16 <genisage> | hi
13:16 <luite> | you might be pleased to learn that you can compile
| haskell to javascript now
@wch
wch / server.r
Last active September 8, 2023 20:25
Shiny example: dynamic input fields
data_sets <- c("mtcars", "morley", "rock")
shinyServer(function(input, output) {
# Drop-down selection box for which data set
output$choose_dataset <- renderUI({
selectInput("dataset", "Data set", as.list(data_sets))
})
# Check boxes