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 / 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 / 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"

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: '_'
 },
var VirtualScroll = function() {
var vs = {};
var numListeners, listeners = [], initialized = false;
var touchStartX, touchStartY;
// [ These settings can be customized with the options() function below ]

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.bash_profile

This will open nano with the contents, at the top in a blank line add the following line:

@function em($target, $context: $base-font-size) {
@if $target == 0 { @return 0 }
@return $target / $context + 0em;
}
$base-font-size: 15px;
h1 {
font-size: em(21px, 15px); // Outputs 1.4em
}
@jdeagle
jdeagle / popup.txt
Created August 27, 2013 18:28 — forked from timrwood/popup.txt
javascript:!function(){var h=location.href,y=h.match(/(youtu.be\/|v\/|u\/\w\/|embed\/|v=)([^#\&\? ]*).*/),v=h.match(/(vimeo.com\/)([^#\&\? ]*)/);y=y&&'http://www.youtube.com/watch_popup/?v='+y[2];v=v&&'http://player.vimeo.com/video/'+v[2];window.open(y||v,"_blank","height=345,width=560");}()
function pretty_number(num, opts)
{
var defaultOpts = {
short: true,
lowerCase: false,
addCommas: true,
round: 2
};
if (typeof num != "number")
@jdeagle
jdeagle / ios-test.css
Created November 6, 2012 19:43 — forked from mattyoho/ios-test.css
iOS Media Queries
// iOS Media Queries
// Goal: capture styles for iPhone, iPhone 3G, iPhone 3GS, iPhone 4, iPhone 4S, iPad, and iPad 2
//
// Author: Tony Schneider (@tonywok)
// Please tell me where I fail. :)
// iPhone v(4,4S) portrait
// test: black text (overwritten by v* portrait) with blue background
@media all and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) {
a {