Skip to content

Instantly share code, notes, and snippets.

al cmdoptesc

Block or report user

Report or block cmdoptesc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cmdoptesc
cmdoptesc / README.md
Last active Aug 29, 2015 — forked from mbostock/.block
D3 Arc Progress Gauge / Meter (for d3-js group)
View README.md

D3: Async Arc Progress Gauge / Meter

View on bl.ocks.org/cmdoptesc/e9b3bfc6f43b4bd237e2

Forked from Bostock's original Progress Events example to answer Rex X's post on the d3-js group:

The progress meter is based on the number of files that have downloaded. In our case, numberOfFiles is set to 20.

We then generate 20 random durations between 0 - 3000ms to simulate download times, and call setTimeout using the durations. Each timer then calls update, which increments the number of files downloaded, increasing the progress arc with a tweening function.

@cmdoptesc
cmdoptesc / README.md
Last active Aug 29, 2015 — forked from mbostock/.block
TopoJSON Examples
View README.md

Some of these files are from the us-atlas:

  • us.json - make topo/us-10m.json
  • us-congress-113.json - make topo/us-congress-10m.json

Others are from the world-atlas:

  • world-50m.json - make topo/world-50m.json
  • world-110m.json - make topo/world-110m.json
View get-selected-text
var getSelectedText = function() {
var txt = "";
if (window.getSelection) {
txt = window.getSelection().toString();
} else if (document.selection && document.selection.type != "Control") {
txt = document.selection.createRange().text;
}
return txt;
};
@cmdoptesc
cmdoptesc / color-palettes
Created Aug 8, 2013
colors schemes combinations
View color-palettes
http://design-seeds.com/
http://www.colourlovers.com/palettes/most-loved/past-month/
@cmdoptesc
cmdoptesc / nodejs-express-cors.js
Created Aug 21, 2013
Node.js Express CORS settings / cross origin resource sharing / XMLHttpRequest Origin is not allowed by Access-Control-Allow-Origin
View nodejs-express-cors.js
// Express CORS middleware.. so much easier than trying to get Restify to work
var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'X-Requested-With, Accept, Origin, Referer, User-Agent, Content-Type, Authorization');
// intercept OPTIONS method
if (req.method === 'OPTIONS') {
res.send(200);
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.graticule {
fill: none;
stroke: #777;
stroke-opacity: .5;
stroke-width: .5px;
}
@cmdoptesc
cmdoptesc / quicksort.js
Created Sep 9, 2013
QuickSort In Place (in JavaScript)
View quicksort.js
// quicksort using new arrays is easy, but surprisingly, there weren't too many examples
// in javascript of in-place quick sort...
// the outer function is simply just a wrapper that copies the original array;
// you can just use lines 12-37 if preserving the original array isn't important
function quickSortInPlace(unsortedArray) {
var unsorted = unsortedArray.slice(); // copy the original array
View git-author-rewrite.sh
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@cmdoptesc
cmdoptesc / Readme.md
Last active Mar 12, 2016
muniNow Quick Demo
View Readme.md

muniNow Demo

muniNow aims to be a nicer NextMuni by giving users the ability to see when the soonest Muni bus is arriving at a glance.

Live demo on Bl.ocks.org

Powered by D3, built at Catalyst/Hack Reactor as a personal project. And many thanks to Mike and Adnan.

al lin, aug. 2013

You can’t perform that action at this time.