Skip to content

Instantly share code, notes, and snippets.

@jkrehm
jkrehm / JSOSDetect
Created June 26, 2014 20:42
Detect operating system in JavaScript via the navigator's version
var mac = /mac/i.test(navigator.appVersion);
var ios = /(iphone|ipad)/i.test(navigator.appVersion);
var win = /(win)/i.test(navigator.appVersion);
var wp = /windows phone/i.test(navigator.appVersion);
var unix = /(linux|x11)/i.test(navigator.appVersion);
var android = /android/i.test(navigator.appVersion);
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['views_paths'] = array(
APPPATH . 'views/'
);
$config['cache_path'] = APPPATH . 'cache/blade/';
@jkrehm
jkrehm / node_builder.build.pp
Created June 4, 2013 15:12
Example of Puppet script, specifically installing Node and some of its packages
class node_builder::build {
class { 'nodejs':
version => '0.10.5',
}
# Uses NPM provider from PuppetLabs Node.js project.
# https://github.com/puppetlabs/puppetlabs-nodejs
package { 'forever':
ensure => installed,
@jkrehm
jkrehm / jsp-for.sublime-snippet
Created September 12, 2012 16:40
Sublime Text 2 Snippets
<snippet>
<content><![CDATA[
<% for (int ${1:i}=${2:start}; $1<${3:end}; $1++) { %>
${4:<!--code-->}
<% } %>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>for</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.html.jsp</scope>