Skip to content

Instantly share code, notes, and snippets.

@curiouslychase
curiouslychase / handlebars-debugger.js
Created February 10, 2014 22:50
A snippets helper for debugging handlebars. Appends debug to all templates so you don't have to type it in yourself, and when a template is rendered, the context is logged in the console.
var scriptsNodeList = document.getElementsByTagName('script'),
debugSet = false,
templates, scripts;
// convert node list to array
scripts = Array.prototype.slice.call(scriptsNodeList);
templates = scripts.filter(function(script) {
return script.type === 'text/x-handlebars-template';
self.bold = function(state) {
self.printer.write(esc);
self.printer.write(chr(69));
// 0 || 'off' = off
// 1 || 'on' = on
self.printer.write(chr(state));
}
/*jshint multistr:true */
var text = "Lorem ipsum Kat sit amet, KrisKris adipiscing elit. Vestibulum Kite consectetur lorem, KKris aliquam turpis Kilts nec. Nam vel mattis."
var myName = "Kris";
var hits = [];
var count = 0;
console.log("**********************");
for (var i=0; i<= text.length; i++)
{
if(text[i]=="K")
@curiouslychase
curiouslychase / post-receive.sh
Last active July 6, 2016 18:23
The post-receive hook that I use for deploying my Wordpress theme on a `git push`.
#!/bin/sh
LOGFILE=./post-receive.log
DEPLOYDIR=$DEPLOYDIR # The place to deploy to.
echo -e "[log] Received push request at $( date +%F)" >> $LOGFILE
echo "[log] - Old SHA: $oldrev New SHA: $newrev Branch Name: $refname" >> $LOGFILE
echo "[log] Starting Deploy..." >> $LOGFILE
@curiouslychase
curiouslychase / anchor-image-code.html
Last active September 28, 2021 09:43
A code example of how to nest an image in an anchor link with Markdown.
<!-- The link we want our bower bird to point to -->
[1]: http://www.bower.io
<!-- The image url we want to use for our img tag source -->
[2]: http://bower.io/img/bower-logo.png
<!--
This will compile to two html nodes:
Anchor: [linked item][1]: <a href="1">linked item</a>
Image: ![alt text][2]: <img src="2" alt="alt text" />
grunt.event.on('watch', function (action, path, target) {
if (target === 'html' || target === 'css' /* and on and on for your target types in watch */) {
grunt.config(['clean', 'any'], []);
// Making an assumption your using sftp and have a current working directory setup
cwd = grunt.config.get(['sftp', 'cwd']) + '/';
path = path.replace(cwd, '');
grunt.config(['sftp', 'options', 'path'], path);
}
});
grunt.initConfig({
// ...other plugins
jshint: {
files: [
'Gruntfile.js',
'cookiejar.js',
'test/*.js'
]
}, // ...other plugins
});
@curiouslychase
curiouslychase / consoleTable.js
Last active December 28, 2015 15:39
Run it in your console!!!
var developerz = [
{ name: "Chase", masterOf: "Learning New Things" },
{ name: "Nate", masterOf: "The Rubies" },
{ name: "Brandon", masterOf: "Javascript" },
// Cache Rules Everything Around Me...
{ name: "Ryan", masterOf: "C.R.E.A.M." },
{ name: "Brian", masterOf: "All the things!" }
];
console.table(developerz);
@curiouslychase
curiouslychase / Gruntfile.js
Created November 12, 2013 03:57
My Gruntfile for realchaseadams.com
// Generated on 2013-08-07 using generator-jekyllrb 0.3.6. Yo Jekyll!
'use strict';
var liveReloadPort = 35729;
var packagejson = require('./package.json');
var lrSnippet = require('connect-livereload')({port: liveReloadPort});
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
var yeomanConfig = {
pkg: packagejson,
@curiouslychase
curiouslychase / .bowerrc
Last active October 2, 2017 09:50
Gist for example bower project blog post.
{
"directory": "src/_lib",
"json": "bower.json"
}