Skip to content

Instantly share code, notes, and snippets.

@domenic
domenic / readable-stream-progress.js
Last active February 10, 2020 17:05
XHR-esque progress events on top of streams
function processBodyChunkwiseWithProgress(res, processChunk) {
const dummyEventTarget = document.createElement("div"); // why isn't EventTarget constructible? :(
const lengthComputable = res.headers.has("Content-Length");
const total = res.headers.get("Content-Length") || 0;
let loaded = 0;
// Using http://underscorejs.org/#throttle
const fireProgressThrottled = _.throttle(fireProgress, 50, { trailing: false });

How to install a Node.js app using Strongloop on Heroku

with different environments like staging and production no less! new: now with multiple account administration!

  1. Create a Node.js app as you would normally, managing your dependencies with npm in package.json.
  2. Your app should be set up to listen on process.env.STRONGLOOP_PORT || [your usual local port].
  3. Download and install the Heroku toolbelt. This install includes git.

➽ If you need to handle multiple accounts, install the accounts plugin.

@mikheyev
mikheyev / world-topo-min.json
Last active August 16, 2016 15:29
World map from http://techslides.com/d3-map-starter-kit/ but with pastel colors
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mlconnor
mlconnor / excel_spreadsheet.html
Created June 26, 2014 18:39
Spreadsheet Excel in 31 lines of code
<!DOCTYPE html>
<html>
<head>
<!-- fiddle is here http://jsfiddle.net/ondras/hYfN3 -->
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Tiny Excel-like app in vanilla JS - jsFiddle demo by ondras</title>
<script type='text/javascript' src='/js/lib/dummy.js'></script>
@eirikb
eirikb / imgur-oauth-test.html
Last active March 6, 2024 14:21
Post to imgur using oauth (api v3) on a static (no server) site
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>imgur oauth</title>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script>
$(function () {
var extractToken = function(hash) {
@nkcmr
nkcmr / torrent_file_processing.js
Created October 10, 2013 12:55
It took 2 days for me to figure out how to process torrent files in JavaScript. So I am publishing my findings. Fully commented and helpful links are dropped in. I hope if you find this it saves you a few hours of hair-pulling and cursing at your screen. Spoiler alert: If you don't know a whole lot about encodings, you're gonna have a bad time ;-;
var debug = require("debug")("torrent:read"); //npm install debug
var bencode = require("bencode"); //npm install bencode - https://en.wikipedia.org/wiki/Bencode
var fs = require("fs");
var crypto = require("crypto");
var _ = require("underscore"); //npm install underscore
var percent_encoding = {
encode: function(buffer) {
var ret = "", a2z, AtoZ, zero2nine, other_valid_symbols, all_unreserved_symbols;
@karmadude
karmadude / README.md
Last active April 2, 2024 01:41
India Map TopoJSON Files

India Map Data

@spivurno
spivurno / gw-gravity-forms-better-pre-submission-confirmation.php
Last active September 23, 2022 15:50
Gravity Wiz // Gravity Forms // Better Pre-submission Confirmation
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-better-pre-submission-confirmation.php
*/
/**
* Better Pre-submission Confirmation
* http://gravitywiz.com/2012/08/04/better-pre-submission-confirmation/
*/
@jcleblanc
jcleblanc / example.php
Created August 23, 2012 20:36
eBay Finding API Samples
<?php
require_once("finding.php");
$ebay = new ebay();
//search by keyword - keywords can be space separated list of searches
print_r($ebay->findProduct('findItemsByKeywords', 'Dresses Pants', 2));
//search by category - dresses = 63861, pants = 63863
print_r($ebay->findProduct('findItemsByCategory', '63861', 2));
@paulmillr
paulmillr / active.md
Last active April 23, 2024 17:32
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user =&gt; user.followers &gt; 1000)