Skip to content

Instantly share code, notes, and snippets.

@swalkinshaw
swalkinshaw / update_ember_changelog.rb
Created October 27, 2015 15:54
Ruby script to update the Ember.js CHANGELOG.md file with new releases
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'octokit', '~> 4.1.0'
end
CHANGELOG_PATH = 'CHANGELOG.md'
def get_releases
@swalkinshaw
swalkinshaw / _mixin_2ximages.scss
Created January 8, 2013 16:06 — forked from replete/_mixin_2ximages.scss
SASS mixin for retina background images. Requires Compass for the image-width and image-height functions.
@mixin image-2x($image1, $image2) {
background-image: url($image1);
@media (min--moz-device-pixel-ratio: 1.3),
(-o-min-device-pixel-ratio: 2.6/2),
(-webkit-min-device-pixel-ratio: 1.3),
(min-device-pixel-ratio: 1.3),
(min-resolution: 1.3dppx) {
background-image: url($image2);
background-size: image-width($image1) image-height($image1);
}
<?php
/*
Plugin Name: Image Optimizer
Plugin URI:
Description: Automatically optimizes images using jpegtran and optipng on upload
Version: 0.1
Author: Scott Walkinshaw
Author URI:
Support URI:
*/
@swalkinshaw
swalkinshaw / Gruntfile.coffee
Created July 8, 2013 20:36
Grunt connect-livereload with pushState rewrites
'use strict'
path = require 'path'
parse = require('url').parse;
module.exports = (grunt) ->
grunt.initConfig
qunit:
all: ['tests/**/*.html']
clean:
@swalkinshaw
swalkinshaw / wp.log
Last active December 20, 2015 21:18
WP Logger output
[2013-08-09 19:40:52] WP.INFO: Started GET /download/ for 192.168.50.1 at 2013-08-09 19:40:52 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'stylesheet_root' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT * FROM wp_users WHERE user_login = 'admin' [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT user_id, meta_key, meta_value FROM wp_usermeta WHERE user_id IN (1) [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_pages' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_calendar' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_tag_cloud' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_nav_menu' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Quer
{
"repositories": [
{
"type": "composer",
"url": "http://wpackagist.org"
},
{
"type": "package",
"package": {
"name": "wordpress",
<?php
namespace Roots\Bedrock;
use League\CommonMark\CommonMarkConverter;
class MarkdownPosts {
const POST_OPTION = 'roots/bedrock/markdown_posts';
const IS_MD_META = 'roots/bedrock/is_markdown';
set :application, 'my_app_name'
set :repo_url, 'git@example.com:me/my_repo.git'
set :branch, :master
set :deploy_to, -> { "/srv/www/#{fetch(:application)}" }
set :log_level, :info
set :linked_files, fetch(:linked_files, []).push('.env')
set :linked_dirs, fetch(:linked_dirs, []).push('web/app/uploads')
namespace :deploy do
desc 'Restart application'
@swalkinshaw
swalkinshaw / Capfile
Last active February 28, 2017 19:17
Sage + Capistrano
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
# Load tasks from gems
require 'capistrano/bower'
require 'capistrano/gulp'
require 'capistrano/npm'
@swalkinshaw
swalkinshaw / tracked_hash.rb
Created July 21, 2017 19:22
Ruby hash delegator that tracks which keys were accessed
class TrackedHash < SimpleDelegator
attr_reader :accessed_keys
def initialize(hash)
super
@accessed_keys = Set.new
end
def [](key)
@accessed_keys << key