Skip to content

Instantly share code, notes, and snippets.

View tylersticka's full-sized avatar

Tyler Sticka tylersticka

View GitHub Profile
function partial(names) {
var hbs = require('hbs')
, fs = require('fs');
if (typeof names == 'string') names = [names];
names.forEach(function(name){
hbs.registerPartial(name, fs.readFileSync(__dirname + '/../views/partials/' + name + '.hbs', 'utf-8'));
});
}
@tylersticka
tylersticka / config.rb
Created July 13, 2012 15:34 — forked from erikjung/config.rb
Testing Compass Vertical Rhythm Loveliness
http_path = "/"
css_dir = ""
sass_dir = ""
images_dir = ""
javascripts_dir = ""
output_style = :expanded
line_comments = false
preferred_syntax = :scss
@tylersticka
tylersticka / gist:2891844
Created June 7, 2012 21:56 — forked from gyndav/gist:1883439
Skip iPhone URL bar
(navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i)) && !location.hash && setTimeout(function(){
!pageYOffset && window.scrollTo(0,1);
}, 1000);
@tylersticka
tylersticka / module.sublime-snippet
Created May 17, 2012 18:43
Sublime Text 2 snippet for JS module
<snippet>
<content><![CDATA[
(function(app) {
var ${1:name} = (function() {
return {
${0}
@tylersticka
tylersticka / gist:2696125
Created May 14, 2012 19:48
My DetectSyntax Sublime settings
{
"syntaxes": [
{
"name": "Mustache",
"rules": [
{"file_name": ".*\\.mustache$"}
]
}
]
}
@tylersticka
tylersticka / gist:2696100
Created May 14, 2012 19:46
My Sublime Text 2 preferences
{
"color_scheme": "Packages/User/Espresso Soda.tmTheme",
"theme": "Soda Light.sublime-theme",
"soda_classic_tabs": true,
"font_face": "Meslo LG S DZ",
"line_padding_top": 2,
"line_padding_bottom": 2
}
@tylersticka
tylersticka / Terminal.sublime-settings
Created May 11, 2012 01:56
Sublime Text Terminal settings for Mintty
{
"terminal": "C:/cygwin/bin/mintty.exe",
// The first and third commands make sure your bin comes through
// The second one prevents a directory change to home
"parameters": ["/bin/env", "CHERE_INVOKING=1", "/bin/bash", "-l"]
}
@tylersticka
tylersticka / gist:2045067
Created March 15, 2012 16:21
Simpler IE fixes with conditional comments and LESS

Simpler IE fixes with conditional comments and LESS

This assumes that you're using conditional comments on the html tag to define classes for certain versions of IE. This technique was originally proposed by Paul Irish and refined in the HTML5 Boilerplate to something like this:

<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->

You can omit the "no-js" class if you aren't using Modernizr, and feel free to remove or tweak the conditional comments to suit the versions of IE that actua

@tylersticka
tylersticka / gist:2001635
Created March 8, 2012 15:53
Mustache layouts
<?php
include 'lib/Mustache/Mustache.php';
class view extends mustache {
public $sections = array();
public function __construct($layout, $page, $view) {
$this->renderPage($page);
@tylersticka
tylersticka / gist:1994574
Created March 7, 2012 17:34
Extends Mustache's partial method to fetch from a known file path.
<?php
class Example extends Mustache {
protected function _getPartial($tag_name) {
$template_path = "./templates/partials/$tag_name.mustache";
if (file_exists($template_path)) {
$this->_partials[$tag_name] = file_get_contents($template_path);
}
return parent::_getPartial($tag_name);