Skip to content

Instantly share code, notes, and snippets.

View etoxin's full-sized avatar

Adam Lusted etoxin

View GitHub Profile
@etoxin
etoxin / tweetSizedTemplate.js
Created July 29, 2014 07:10
Tweet Sized Template
function t(s,d){
for(var p in d)
s=s.replace(new RegExp('{'+p+'}','g'), d[p]);
return s;
}
Call it like this:
t("Hello {who}!", { who: "JavaScript" });
// "Hello JavaScript!"
@etoxin
etoxin / svn.sh
Last active August 29, 2015 14:04
SVN Terminal commands
# Update Repo excluding externals.
svn update --ignore-externals
# commit
svn commit -m "Fixed bug."
# Merge from trunk to branch. Make sure your in the correct directory eg. static/
svn merge https://svn.hhi.net.au/pagecraft/Toyota/MainWebsite/static/
// safely wrap console
'console' in window && console.log("Boom!");
@etoxin
etoxin / grid.html
Created July 31, 2014 05:09
Simple SCSS Grid
<div class="row">
<div class="grid-6">Column A</div>
<div class="grid-6">Column B</div>
</div>
<div class="row">
<div class="grid-4">Column A</div>
<div class="grid-4">Column B</div>
<div class="grid-4">Column C</div>
</div>
<div class="row">
@etoxin
etoxin / spacers.html
Created July 31, 2014 05:17
SCSS Vertical Spacers
<div class="spacer50"></div>
@etoxin
etoxin / git.md
Last active May 31, 2024 11:58
GIT Bash Commands

search (regex)

git grep "regex"

list all branches

git branch -a
@etoxin
etoxin / gist:89edbf36f79691ab5026
Created August 12, 2014 04:49
run multiple jQuery instances.
<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- load jQuery 1.11.1 -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
var jQuery_1_11_1 = $.noConflict(true);
</script>
@etoxin
etoxin / jsdoc.js
Last active August 29, 2015 14:05
jsdoc
// @type documentation http://usejsdoc.org/tags-type.html
/** @type {Array.<jQuery>} An array of jQuery elements */
var elements = $('div');
@etoxin
etoxin / Async2.js
Last active August 29, 2015 14:07
Asynchronous Callbacks
function logItem(item) {
console.log(item);
}
function asyncEach3(arr, callback) {
// Utility inner function to create a wrapper function for the callback
function makeCallbackWrapper(arr, i, callback) {
// Create our function scope for use inside the loop
return function() {
callback(arr[i]);
@etoxin
etoxin / faqCopy.js
Last active August 29, 2015 14:07
Grab Copy convert to jekyll
(function(){
console.log( $('#category-sales-content').html() + ':' );
$('.faq-list').each(function(i, item){
var $item = $(item);
console.log( $item.find('.faq-title').html() );
});
})()