Skip to content

Instantly share code, notes, and snippets.

View kalepail's full-sized avatar
🦐
Work, and stuff will happen.

Tyler van der Hoeven kalepail

🦐
Work, and stuff will happen.
View GitHub Profile
@kalepail
kalepail / entry
Last active August 29, 2015 13:59
Statamic Feed for iTunes
---
podcast: /assets/podcasts/short.mp3
title: Finding Creative Inspiration
tags:
- rad
- new
- awesome
---
Today we discuss the importance of the global economy in our desktop jobs. How Squidword may just be onto something and why its important to always wear a towel around your head when entering and exiting public rest areas.
@kalepail
kalepail / app.js
Created April 12, 2014 16:30
Return first image url from a string of content
var rex = /<img[^>]+src="?([^"\s]+)"?[^>]*\/>/g;
for (var i = 0; i < count; i++) {
var content = obj[i].content,
img = content.match(rex);
var results = rex.exec(content);
if (results != null) {
var source = results[1];
@kalepail
kalepail / natural.js
Last active August 29, 2015 14:08
Get an image's natural width and height
(function($){ var props = ['Width', 'Height'], prop;
while (prop = props.pop()) {
(function (natural, prop) {
$.fn[natural] = (natural in new Image()) ?
function () {
return this[0][natural];
} :
function () {
var
node = this[0],
@kalepail
kalepail / SassMeister-input.scss
Created January 6, 2015 18:59
Generated by SassMeister.com.
// ----
// Sass (v3.4.9)
// Compass (v1.0.1)
// ----
$purple: #7049A3;
// Turn rgba values to rgb values
@function rgba2rgb($color, $bg : 255) {
$a: alpha($color);
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
livereload = require('gulp-livereload'),
phpServer = require('php-built-in-server'),
scsslint = require('gulp-scsslint'),
@kalepail
kalepail / gulpfile.js
Last active December 14, 2015 21:08
Rename files with Gulp
var gulp = require("gulp");
var rename = require("gulp-rename");
gulp.task('default', function() {
return gulp.src("./*.md")
.pipe(rename(function(path) {
path.basename = path.basename.replace(/(\D*\d{4}-\D*\d{2}-\D*\d{2})(-)/, "$1.");
}))
.pipe(gulp.dest("./renamed"));
});
// Alert if there are any stuck jobs
let stuck_jobs = Jobs.find(‘_id’, {
status: {$in: [‘ready’, ‘running’]}
}, {fields: {
type: 1,
data: 1
}}).fetch();
if (stuck_jobs.length > 0)
Raven.log(3, ‘There are stuck jobs’, stuck_jobs);
{ // A View item
"_id" : "abc123_view_id",
"page" : "/some/page",
"site" : "www.example.com",
"bounce" : false,
"token" : "7a13d56",
"end" : ISODate("2017-03-23T18:29:22.137Z"),
"start" : ISODate("2017-03-23T18:21:22.156Z"),
"browser" : false,
"session" : true,
function extend(objects) {
var result = {};
for (var i = 0; i < objects.length; i++) {
var object = objects[i];
for (var key1 in object) {
if (result.hasOwnProperty(key1)) {
for (var key2 in object[key1]) {
result[key1][key2] = object[key1][key2];
@kalepail
kalepail / custom.conf
Created July 25, 2017 18:56
My custom mechanic.conf template for rolling deployments on Meteor
{# Let folks know this wasn't a manual configuration #}
# This configuration file was generated with mechanic.
{% macro server(site, settings, options) %}
include "{{ settings.overrides }}/{{ site.shortname }}/top";
server {
gzip on;