Skip to content

Instantly share code, notes, and snippets.

Ian Young ijy

Block or report user

Report or block ijy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ijy
ijy / cartesian-product.js
Last active Nov 14, 2019
Underscore.js implementation of Cartesian Product (without any mutable variable). @see: http://stackoverflow.com/questions/12303989/cartesian-product-of-multiple-arrays-in-javascript
View cartesian-product.js
function cartesianProductOf() {
return _.reduce(arguments, function(a, b) {
return _.flatten(_.map(a, function(x) {
return _.map(b, function(y) {
return x.concat([y]);
});
}), true);
}, [ [] ]);
};
@ijy
ijy / xhtml-to-markdown.xsl
Created Jul 21, 2013
XHTML to Markdown converter.
View xhtml-to-markdown.xsl
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- XHTML-to-Markdown converter by Andrew Green, Article Seven, http://www.article7.co.uk/ -->
<!-- This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. -->
<xsl:stylesheet version='1.0' xmlns:h="http://www.w3.org/1999/xhtml" xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method='text' encoding='utf-8'/>
@ijy
ijy / sublime-text-3-setup.md
Last active Sep 6, 2019
My Sublime Text 3 setup.
View sublime-text-3-setup.md

Sublime Text 3 Setup

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following:
@ijy
ijy / search-and-replace-2.xsl
Created Sep 15, 2013
Alternative search and replace template for XSLT 1.0.
View search-and-replace-2.xsl
<!--
ALTERNATIVE SEARCH & REPLACE
string: The text to be evaluated
replace: The character or string to look for in the above string
with: What to replace it with
Slightly more long winded approach if that's how you prefer to roll.
-->
<xsl:template name="string-replace">
@ijy
ijy / Laravel: Blade: Limit foreach loop.php
Created Jun 22, 2013
A quick and easy way to limit a foreach loop in Laravel Blade.
View Laravel: Blade: Limit foreach loop.php
@foreach (array_slice($posts->toArray(), 0, 5) as $post)
<h1>{{ $post['title'] }}</h1>
@endforeach
@ijy
ijy / multiple-push-urls.md
Created May 7, 2018 — forked from bjmiller121/multiple-push-urls.md
Add multiple push URLs to a single git remote
View multiple-push-urls.md

Sometimes you need to keep two upstreams in sync with eachother. For example, you might need to both push to your testing environment and your GitHub repo at the same time. In order to do this simultaneously in one git command, here's a little trick to add multiple push URLs to a single remote.

Once you have a remote set up for one of your upstreams, run these commands with:

git remote set-url --add --push [remote] [original repo URL]
git remote set-url --add --push [remote] [second repo URL]

Once set up, git remote -v should show two (push) URLs and one (fetch) URL. Something like this:

@ijy
ijy / gitcom.md
Created May 7, 2018 — forked from jedmao/gitcom.md
Common git commands in a day-to-day workflow
View gitcom.md

Git Cheat Sheet

Initial Setup

Initialize a repo

Create an empty git repo or reinitialize an existing one

$ git init
@ijy
ijy / check-null-empty.xsl
Created Sep 15, 2013
XSLT: Check if a string is null or empty.
View check-null-empty.xsl
<!--
CHECK IF A STRING IS NULL OR EMPTY
-->
<!-- Example XML -->
<group>
<item>
<id>item 1</id>
<CategoryName>blue</CategoryName>
</item>
@ijy
ijy / osx_lion_rail_setup.md
Created Jul 11, 2012 — forked from jpantuso/osx_lion_rail_setup.md
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL
View osx_lion_rail_setup.md
@ijy
ijy / banner.css
Created Mar 20, 2018
Tailwind, postcss-import, & cssnext media queries
View banner.css
.c-banner {
...
height: 400px;
outline: 5px solid red;
/* Breakpoints ========================================================= */
@media (--tablet) {
height: 500px;
}
You can’t perform that action at this time.