Skip to content

Instantly share code, notes, and snippets.

background: linear-gradient(45deg, #222 12%, transparent 0, transparent 88%, #222 0),
linear-gradient(135deg, transparent 37%, #111 0, #444 32%, #111 63%, transparent 0),
linear-gradient(45deg, transparent 37%, #222 0, #222 63%, transparent 0) #000;
background-size: 15px 15px;
@uhop
uhop / geom.js
Last active November 11, 2020 23:18
All necessary Pie chart calculations based on dojox.charting.
var TWO_PI = 2 * Math.PI;
function tmpl (template, dict) {
return template.replace(/\$\{([^\}]*)\}/g, function (_, name) {
return dict[name];
});
}
function makeSegment (args, options) {
// args is {startAngle, angle, index, className}
@uhop
uhop / print.html
Last active November 29, 2022 23:35
The way to print slides as PDF.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Multi-page print test</title>
<!--
Print to PDF, landscape, letter size, no margins, enable background graphics.
Tested on Chrome.
-->
<style>
Verifying that +elazutkin is my blockchain ID. https://onename.com/elazutkin
@uhop
uhop / nginx-webp-sample.conf
Last active November 3, 2023 12:09
Serving WEBP with nginx conditionally.
user www-data;
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
* + table {
border-style:solid;
border-width:1px;
border-color:#e7e3e7;
}
* + table th, * + table td {
border-style:dashed;
border-width:1px;
border-color:#e7e3e7;
@uhop
uhop / minified.js
Last active December 15, 2015 18:19
UMD header
/* UMD.define */ (typeof define=="function"&&define||function(d,f,m){m={module:module,require:require};module.exports=f.apply(null,d.map(function(n){return m[n]||require(n)}))})
(["module", "../main"], function(module, unit){
// module's code
});
/* UMD.require */ (typeof define=="function"&&require||function(d,f,m){m={module:module,require:require};f.apply(null,d.map(function(n){return m[n]||require(n)}))})
(["module", "../main"], function(module, unit){
// module's code
});
@uhop
uhop / gist:3351030
Created August 14, 2012 17:29 — forked from idan/gist:3135754
A Sample Post

Hello there! This is a sample post for gist.io, a super-lightweight writing soapbox for hackers.

Now look up. Further. Above the post title. See that grey text with the gist ID?

Now back to me. That grey text is a link! Open that sucker in a new tab to see the source for this post. Also, I'm on a horse.

This is a major heading

If you peek at it with a web inspector, you'll see that it is a second-level heading. You can use first level headings, but they'll look just like the second level ones, and the gods of the HTML5 outlining algorithm will frown upon you.

@uhop
uhop / perf.js
Created August 14, 2012 15:48
Benchmarking creating an object
// Creating different objects.
var z = 5;
this.group(
"Primitives",
function Nothing(x) { return; },
function Null(x) { return null; },
function Boolean(x) { return true; },
function Number(x) { return 1; },
@uhop
uhop / gist:3259255
Created August 4, 2012 18:41
Bezier Shaders & Vector openGL rendering