Skip to content

Instantly share code, notes, and snippets.

@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>
@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,
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['views_paths'] = array(
APPPATH . 'views/'
);
$config['cache_path'] = APPPATH . 'cache/blade/';
@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);
@jkrehm
jkrehm / GetCommits.js
Last active August 29, 2015 14:03
Get commits by repository & branch from Jira
/*jshint browser:true, devel:true*/
/*global $*/
$(document).on('click', '#dvcs-commits-tabpanel', function () {
// Wait for the commits to load...
setTimeout(function () {
var commits = {};
$('.CommitHeader > a').each(function() {
var $this = $(this);
@jkrehm
jkrehm / PSTurboMode.js
Created August 7, 2014 18:41
Add turbo mode to PeopleSoft process monitor refresh
var $frame = $('#ptifrmtgtframe');
$frame.load(function () {
// If refresh button not found, don't continue
if ($frame.contents().find('#REFRESH_BTN').length === 0) {
$('#turbo-enabled').remove();
return;
}
@jkrehm
jkrehm / FacebookUtilities.js
Last active August 29, 2015 14:06
Facebook Utilities
/* CSS
.timerWrapper {
color: #fff;
left: 5px;
position: fixed;
top: 5px;
z-index: 9999;
}
.timer {
height: 15px;
@jkrehm
jkrehm / cvedetails-php-versions.json
Created January 11, 2015 16:20
CVEDetails.com PHP version ID's
[
{
"version": "5.6.4",
"id": "178362"
},
{
"version": "5.6.3",
"id": "178179"
},
{
@jkrehm
jkrehm / DraggableJiraDialogs.js
Last active August 29, 2015 14:20
DraggableJiraDialogs.js
// Requires Chrome and the Control Freak (https://chrome.google.com/webstore/detail/control-freak/jgnchehlaggacipokckdlbdemfeohdhc) extension
/* Libs:
- https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
- https://cdnjs.cloudflare.com/ajax/libs/draggabilly/1.2.0/draggabilly.pkgd.min.js
- https://cdn.rawgit.com/meetselva/attrchange/d3f8524374b0ad11f320b51f7b188ae940314dba/js/attrchange.js
*/
// Make dialogs draggable
$(function () {
AJS.$(document).ajaxSuccess(function (e, xhr, settings) {
if (/\/dev-status\/.*dataType=repository/.test(settings.url)) {
xhr.done(function (data) {
var info = {};
data.detail[0].repositories.forEach(function (repository) {
info[repository.name] = info[repository.name] || [];
info[repository.name] = _.pluck(repository.commits, 'id');
});