Skip to content

Instantly share code, notes, and snippets.

@jdeagle
jdeagle / SassMeister-input.scss
Created July 18, 2015 18:08
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
@function get-px-from-vw($vw, $contextWidth) {
@return (($contextWidth / 100) * $vw) + px;
}
@function strip-units($number) {
@if type-of($number) == "number" and not unitless($number) {
@return $number / ($number * 0 + 1);
@jdeagle
jdeagle / vcl-regex-cheat-sheet
Created February 12, 2016 19:56 — forked from dimsemenov/vcl-regex-cheat-sheet
Regular expression cheat sheet for Varnish (.vcl). Examples of vcl regexp. Found here http://kly.no/varnish/regex.txt (by Kristian Lyngstøl)
Regular expression cheat sheet for Varnish
Varnish regular expressions are NOT case sensitive. Varnish uses POSIX
regular expressions, for a complete guide, see: "man 7 regex"
Basic matching:
req.url ~ "searchterm"
True if req.url contains "searchterm" anywhere.
req.url == "searchterm"
@jdeagle
jdeagle / sphere.js
Created March 1, 2016 23:53
JS Sphere
var planePositions = [];
var r = 1;
m = 3, // u segments
n = 3, // v segments
quads = [];
function getPlaneIndexes () {
var buffer = [];
var points = [],
@jdeagle
jdeagle / MyComponent.js
Created March 27, 2016 16:55 — forked from markdalgleish/MyComponent.js
CSS Modules + ReactCSSTransitionGroup in React 0.14
import transitions from './transitions.css';
export default () => (
<ReactCSSTransitionGroup transitionName={transitions}>
{ ... }
</ReactCSSTransitionGroup>
);
@jdeagle
jdeagle / notes.md
Last active January 23, 2018 16:17
Notes for Hector PBF

PBF notes for hector

Global

Use const if you aren’t going to reassign the variable value (especially for functions)

Mesher

72: for (let i = 0; i <trianglesOnVoxels.length; i ++) tInV.push(trianglesOnVoxels[i].length);
@jdeagle
jdeagle / watermark.sh
Created May 5, 2020 22:51 — forked from dcrck/watermark.sh
Watermarking for my photos. Run like `./watermark.sh input_file.jpg`, which produces `input_file_wm.jpg`
#!/bin/bash
if [ "$1" != "" ]; then
dr=$(dirname $1)
scdr=$(dirname $0)
fn=$(basename $1)
filename="${fn%%.*}"
extension="${fn#*.}"
output="${dr}/${filename}_wm.${extension}"
# wm.png is my watermark. It's a white logo with 50% opacity and a transparent background.
wm="${scdr}/wm.png"