Skip to content

Instantly share code, notes, and snippets.

View blahah's full-sized avatar

Rik blahah

View GitHub Profile
@moarshy
moarshy / untitled11.ipynb
Created May 27, 2022 08:59
Untitled11.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eliocamp
eliocamp / new_aes.R
Last active June 16, 2023 09:07
A way to add multiple color or fill scales to a ggplot2 plot
# All this is implemented (plus bugfixes!) in the ggnewscale package:
# https://github.com/eliocamp/ggnewscale
# If you have any issues, I prefer it if you send them as issues here:
# https://github.com/eliocamp/ggnewscale/issues
#' Allows to add another scale
#'
#' @param new_aes character with the aesthetic for which new scales will be
#' created
#'
@jagrosh
jagrosh / Github Webhook Tutorial.md
Last active May 4, 2024 06:51
Simple Github -> Discord webhook

Step 1 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send commits and other updates

  2. In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe! WebhookDiscord

Step 2 - Set up the webhook on Github

  1. Navigate to your repository on Github, and open the Settings Settings
@Rich-Harris
Rich-Harris / service-workers.md
Last active April 21, 2024 16:24
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@klmr
klmr / lambda.r
Last active April 13, 2023 11:27
Finally a proper lambda for R
`<-` = function (body, params) {
vars = all.vars(substitute(params))
formals = as.pairlist(setNames(replicate(length(vars), quote(expr = )), vars))
eval.parent(call('function', formals, substitute(body)))
}
sapply(1 : 4, x -> 2 * x)
# 2 4 6 8
mapply(x ~ y -> x + y,
@james2doyle
james2doyle / atom-nice-font.less
Created February 27, 2014 22:12
nice fonts and scrollbars in the Atom editor!
body {
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
-moz-osx-font-smoothing: grayscale;
}
.tree-view-resizer, .editor {
::-webkit-scrollbar {
width: 0.5em;
height: 0.5em;
@debasishg
debasishg / gist:8172796
Last active March 15, 2024 15:05
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&amp;rep=rep1&amp;t
@dhcole
dhcole / form.js
Created November 3, 2012 19:31
Submit data from html form to Google Doc Spreadsheet. Uses Bootstrap components for auto-complete region list and date selection.
$(function(){
var formUrl = '/* ex: https://docs.google.com/a/developmentseed.org/spreadsheet/formResponse?formkey=... */';
// Set up map
var m = mapbox.map('map').addLayer(mapbox.layer().id(' /* mapbox-account.id */ '));
// Set up map ui features with point selector
var ui = mapbox.ui().map(m).auto().pointselector(function(d) {
// Remove all points except the most recent