Skip to content

Instantly share code, notes, and snippets.

@domenic
domenic / promises.md
Last active October 13, 2024 22:51
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@mbostock
mbostock / README.md
Last active June 7, 2023 18:33
Underscore’s Equivalents in D3

Collections

each(array)

Underscore example:

_.each([1, 2, 3], function(num) { alert(num); });
@NicholasFazio
NicholasFazio / index.html
Created November 23, 2012 20:52
A CodePen by Scott Bram. Star Wars 3D Scrolling Text in CSS3 (with music) - http://www.sitepoint.com/css3-starwars-scrolling-text/
<!-- ALL CREDIT FOR THE SCROLLING TEXT GOES TO
Craig Buckler
http://www.sitepoint.com/css3-starwars-scrolling-text/
Blame me for the music via embedded video bit
-->
<div style="border:1px solid darkred;overflow:hidden; position:absolute; left:0; top:0; width:50px; height:25px;">
<div style="margin-top:-290px;">
<object width="420" height="315">
@NelsonMinar
NelsonMinar / README.md
Last active February 9, 2017 16:31 — forked from ZJONSSON/index.html
@biovisualize
biovisualize / README.md
Last active June 18, 2024 08:32
direct svg to canvas to png conversion

It seems that Chrome finally found a way to let us convert from svg to canvas to png without the tainted canvas security feature/bug.

@filipbec
filipbec / gist:5998034874b119fab0e4
Created September 5, 2014 12:31
Scannr - Keys for obtaining US Driver's license data
@stevemandl
stevemandl / index.html
Last active February 13, 2016 02:18
UpdatingCrossfilter Demo
<script src="https://cdnjs.cloudflare.com/ajax/libs/crossfilter/1.3.12/crossfilter.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dc/2.0.0-beta.20/dc.js"></script>
<script src="updatingCrossfilter.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dc/2.0.0-beta.20/dc.css" />
<div> DC Version: <span id="version"></span></div>
<div id="timechart"></div>
<div id="histogram"></div>
<script>
var getData = function (d) { return {ts: d, y: Math.random()* 2 -1 }; }, //get a data point
@pallih
pallih / haestirettur.csv
Created February 9, 2016 22:38
lýsigögn í HTML kóða dóma á haestirettur.is
We can't make this file beautiful and searchable because it's too large.
Author,HyperlinksChanged,LinksUpToDate,AllowPNG,Version,Template,Revision,Company,LastSaved,Characters,Pages,Words,Created,Bytes,LastAuthor,Lines,AppVersion,CharactersWithSpaces,OfficeDocumentSettings,DocSecurity,ShareDoc,TotalTime,url,RelyOnVML,ScaleCrop,PixelsPerInch,Paragraphs,Keywords,LastPrinted
Jakobína Sveinsdóttir,,,,10.2625,,2,Hæstiréttur Íslands,2003-03-29T12:44:00Z,4138,3,725,2003-03-29T12:44:00Z,16384,Gummi,34,,4854,,,,4,http://www.haestirettur.is/domar?nr=4,,,,9,,1999-01-12T10:23:00Z
Jakobína Sveinsdóttir,,,,10.2625,,2,Hæstiréttur Íslands,2003-03-29T12:43:00Z,6308,3,1106,2003-03-29T12:43:00Z,19456,Gummi,52,,7400,,,,70,http://www.haestirettur.is/domar?nr=6,,,,14,,1999-01-11T13:36:00Z
Ritari 2,,,,10.2625,,2,Hæstiréttur Íslands,2003-03-29T12:42:00Z,46891,19,8226,2003-03-29T12:42:00Z,69632,Gummi,390,,55007,,,,176,http://www.haestirettur.is/domar?nr=7,,,,110,,1999-01-14T08:38:00Z
Skúli Magnússon,,,,10.2625,,2,Hæstiréttur,2003-03-29T12:40:00Z,5058,3,887,2003-03-29T12:40:00Z,25600,Gummi,42,,5934,,,,34,h
@dominictarr
dominictarr / readme.md
Created November 26, 2018 22:39
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu

@ian-whitestone
ian-whitestone / notes.md
Last active March 1, 2023 01:45
Best practices for presto sql

Presto Specific

  • Don’t SELECT *, Specify explicit column names (columnar store)
  • Avoid large JOINs (filter each table first)
    • In PRESTO tables are joined in the order they are listed!!
    • Join small tables earlier in the plan and leave larger fact tables to the end
    • Avoid cross joins or 1 to many joins as these can degrade performance
  • Order by and group by take time
    • only use order by in subqueries if it is really necessary
  • When using GROUP BY, order the columns by the highest cardinality (that is, most number of unique values) to the lowest.