Skip to content

Instantly share code, notes, and snippets.

View tcrammond's full-sized avatar

Tyler tcrammond

  • United Kingdom
View GitHub Profile
@tcrammond
tcrammond / nvm-auto-run.md
Created October 23, 2017 08:01
Automatically nvm use when entering directory

Calling nvm use automatically in a directory with a .nvmrc file

Put this into your $HOME/.zshrc to call nvm use automatically whenever you enter a directory that contains an .nvmrc file with a string telling nvm which node to use:

place this after nvm initialization!

@tcrammond
tcrammond / Karabiner Diamond Arrows
Last active October 20, 2017 12:35
Karabiner-Elements - change fn + i/j/k/l to arrows
// Adapted from https://pqrs.org/osx/karabiner/complex_modifications/json/vi_style_arrows3.json
// 1. vim ~/.config/karabiner/karabiner.json
// 2. Enter the below in complex modifications array
// 3. Check it's enabled inside karabiner UI.
{
"title": "Diamond arrows",
"rules": [
{
"description": "Change Function+i/j/k/l to Arrows",
@tcrammond
tcrammond / adyenTestCard.js
Last active November 21, 2016 12:20
Bookmarklet to enter test card on Adyen test payment
javascript:(function () { document.getElementById('card.cardNumber').value = '4111111111111111'; document.getElementById('card.cardHolderName').value = 'Nyancat'; document.getElementById('card.expiryMonth').value = '08'; document.getElementById('card.expiryYear').value = '2018'; document.getElementById('card.cvcCode').value = '737' ; }());
@tcrammond
tcrammond / target-metro.scss
Last active October 2, 2020 13:50
A sass mixin to write css that targets only IE 10 and IE 11
// Thanks http://philipnewcomer.net/2014/04/target-internet-explorer-10-11-css/
/*
Usage:
@include target-metro {
color: cyan;
}
*/
@mixin target-metro {
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
@tcrammond
tcrammond / image-url.scss
Created February 1, 2016 08:51
Scss image-url function
// libsass removed the image-url function as of 3.x
// This is a basic replacement I have used.
$assets-folder: some/path;
@function image-url ($url) {
@return url($assets-folder + '/' + unquote($url));
}
@tcrammond
tcrammond / handlebars-moment-helper.js
Last active October 23, 2015 15:10
Handlebars moment date format helper
// Amended from https://gist.github.com/elidupuis/1468937
/**
* Formats the given date using moment
* Both format and default parameters are optional
* usage: {{date-format myDate format="DD MM YYYY" default="N/A"}}
*/
Handlebars.registerHelper('date-format', function(context, block) {
if (window.moment && context !== null && context !== '') {
var format = block.hash.format || "DD-MM-YYYY";