Skip to content

Instantly share code, notes, and snippets.

@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"
@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 / 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 / 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 / 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 / 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 / getTemplate.php
Created July 9, 2015 18:33
Query dependant timber rendering
class InspirationModule
{
public $template;
public $query;
public $vars;
}
$moduleA = new InspirationModule();

If you are using backbone (and backbone.marionette) in a browserify managed project, you will likely run into issues with underscore (at least if you manage your dependencies with npm). Each package, that has underscore as a dependency, will require its own version of underscore (making your bundle file contain multiple versions of underscore). Back in the days, you could shim backbone and underscore like:

browserify({
	shim: {
		'underscore': {
			path: './node_modules/underscore/underscore.js',
			exports: '_'
 },
@jdeagle
jdeagle / SVGPath.js
Created June 5, 2015 16:06
SVG Path example
var TweenLite = require("TweenLite");
var proxy = {};
function getSize(ratio, total) {
return total * ratio;
}
function getProps(el, values) {
@jdeagle
jdeagle / gist:34e0f53d1c8bdb7d58c8
Created May 11, 2015 14:11
Change permissions for NPM node modules
sudo chown -R $USER ~/.npm
sudo chown -R $USER /usr/local/lib/node_modules