Skip to content

Instantly share code, notes, and snippets.

View maggiben's full-sized avatar

Benjamin maggiben

  • Salesforce
  • Argentina
View GitHub Profile
@joubertnel
joubertnel / gist:870190
Last active July 8, 2023 12:52
HTML5 Canvas - Rendering of Text on high-DPI screens
<html>
<head>
<script src='http://code.jquery.com/jquery-1.5.1.min.js'></script>
</head>
<body>
<h2>Naive canvas</h2>
<canvas id="naive" width="400" height="50"></canvas>
<h2>High-def Canvas</h2>
@rmarimon
rmarimon / README
Created August 13, 2011 17:10
Dial Chart examples
Dial Chart examples. Suggestions and enhancements are welcome.
@tomerd
tomerd / gauge.js
Last active April 21, 2024 21:08
google style gauges using javascript d3.js
function Gauge(placeholderName, configuration)
{
this.placeholderName = placeholderName;
var self = this; // for internal d3 functions
this.configure = function(configuration)
{
this.config = configuration;
@RedBeard0531
RedBeard0531 / functions.js
Created February 22, 2012 20:13
Min, Max, Sum, Count, Avg, and Std deviation using MongoDB MapReduce
// derived from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
function map() {
emit(1, // Or put a GROUP BY key here
{sum: this.value, // the field you want stats for
min: this.value,
max: this.value,
count:1,
diff: 0, // M2,n: sum((val-mean)^2)
});
@nathanhammond
nathanhammond / Emscripten OS X.md
Created March 4, 2012 21:48
How to get Emscripten running on OS X.

Running emscripten on OS X

There are a number of additional dependencies required for getting things installed on OS X. Starting with a blank slate OS X machine, this is the process it takes:

# Install Xcode Command Line Tools

# Install Homebrew
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
@wbzyl
wbzyl / README.md
Created July 17, 2012 20:42
Glow Filter

SVG Essentials – Filters

This is a recreation (for the purpose of tinkering with an implementation in d3.js) of the example from the book SVG Essentials by J. David Eisenberg.

The <feColorMatrix> element allows to change color values in a following way.

@jbt
jbt / gist:3150819
Created July 20, 2012 13:47
If you can tell me what these two functions are for, you win a prize
t.prototype.REDACTED = function(a, b, j, c, g) {
for(var r = this.REDACTED2(0), t = Math.tan(r), C = g % 86400 / 86400 * Math.PI * 2, g = [], n = 0;n <= c + 1;n = n + 1) {
g[n] = Math.atan(Math.cos(2 * Math.PI * (j + n / c) / a + C) / t) / Math.PI * c * a / 2 - (b - a / 4) * c;
}
b = Math.max.apply(Math, g);
j = Math.min.apply(Math, g);
a = "";
if(g[0] > 0 && g[0] < c) {
a = "M0," + g[0];
if(b >= c) {
@r3b
r3b / divSwirl.js
Last active July 29, 2019 20:46
create a spinning vortex of randomly-colored divs on any page. handy if you need to create entropy or stress on a page. Now with stars!
(function(){
var db = document.body, //shortcut to document.body
r = 100, //initial radius of the circle
x = (db.clientWidth - r) / 2, //horizontal center
y = (window.pageYOffset || (db.parentNode || db).scrollTop) + ((window.innerHeight+r)/2), //offset from page top
o = 0.0, //angle offset
w = 0, //width of square
dl = 150, //number of divs
ai=Math.PI / dl, //pie slice width
divs=Array.prototype.map.call(new Int8Array(dl),function(){ //div array
@mbostock
mbostock / .block
Last active November 14, 2023 01:06
Solar Terminator
license: gpl-3.0
redirect: https://observablehq.com/@mbostock/solar-terminator
@LinuxPanda
LinuxPanda / Youtube_Regex_Grab_Video-Playlist_ID_With_Time.php
Last active March 10, 2022 16:10
Best regex pattern to get youtube video/playlist id with/without time from any youtube link and generate embed code. This regex works with 1) youtube & youtu.be 2) http/https 3) with/without www.
<?php
/*
* @gist Regex to get youtube video/playlist id with/without time & generate embed code
* @license UNLICENSE (http://unlicense.org)
*/
$youtube_url = array(
"https://youtu.be/yVpbFMhOAwE",
"https://www.youtube.com/embed/yVpbFMhOAwE",