Skip to content

Instantly share code, notes, and snippets.

View timkinnane's full-sized avatar

Tim Kinnane timkinnane

View GitHub Profile
@christhesoul
christhesoul / deploy.rb
Created August 5, 2014 21:23
sample bedrock deploy.rb
set :theme_path, Pathname.new('web/app/themes/my_wp_theme')
set :local_app_path, Pathname.new('/Applications/MAMP/htdocs/my_wp_app')
set :local_theme_path, fetch(:local_app_path).join(fetch(:theme_path))
namespace :deploy do
task :compile_assets do
run_locally do
within fetch(:local_theme_path) do
execute :grunt, :build
end
@nateroling
nateroling / deploy.addendum.rb
Last active July 15, 2016 07:11
Roots Bedrock: Copy production assets for Roots theme
# The Roots theme by default does not check production assets into Git, so
# they are not deployed by Capistrano when using the Bedrock stack. The
# following will compile and deploy those assets. Copy this to the bottom of
# your config/deploy.rb file.
# Based on information from this thread:
# http://discourse.roots.io/t/capistrano-run-grunt-locally-and-upload-files/2062/7
# and specifically this gist from christhesoul:
# https://gist.github.com/christhesoul/3c38053971a7b786eff2
@SamRothCA
SamRothCA / memoryusage.sh
Created October 30, 2014 20:38
Memory Usage
ps xmo rss=,pmem=,comm= | while read rss pmem comm; ((n++<5)); do
size="$[rss/1024]";
short=$[4-${#size}];
size="(${size}M)";
i=0;
while ((i++ < short)); do size=" $size"; done;
pmem="${pmem%%.*}"
if (($pmem >= 20)); then color=$'\e[31m';
@timkinnane
timkinnane / dynamic_image_downsize.php
Created February 2, 2015 08:49
Filter the output of image_downsize() to return dynamically generated images for intermediate or inline sizes. Long description in php doc block.
<?php
/**
* Filter the output of image_downsize() to return dynamically generated images for intermediate or inline sizes.
*
* <p>Because Wordpress generates all image sizes on first upload, if you change
* theme or size settings after the upload, there won't be a matching file for
* the requested size.<br/>
* This filter addresses the problem of the default downsize process laoding
* a large file and scaling it down in the browser if it doesn't find the right
* size image. This can cause large files to be loaded unnecessarily and will
@dannyockilson
dannyockilson / gist:52a444195f0df873cc1c
Created March 13, 2015 17:11
Simple Angular Service for WordPress
'use strict';
angular.module('wordpress', [])
.service( 'wpService',
function($http, $q){
var url = 'http://allin.local/wp-json/';
return({
@sebastianzillessen
sebastianzillessen / print-broadcasts.js
Created April 14, 2015 14:56
AngularJS decorator to display all $emit and $broadcast events of an application.
angular.module('print-broadcasts', []).config(['$provide', function ($provide) {
$provide.decorator('$rootScope', function ($delegate) {
var _emit = $delegate.$emit;
var _broadcast = $delegate.$broadcast;
$delegate.$emit = function () {
console.log("[$emit] " + arguments[0] + " (" + JSON.stringify(arguments) + ")");
return _emit.apply(this, arguments);
};
@robmiller
robmiller / wp-audit
Last active June 26, 2017 23:33
wp-audit — a script that searches for WordPress installs on disk, and tells you: whether WordPress is out-of-date; whether any of the plugins you're using are out-of-date; and whether any of the core WordPress files have been tampered with. Requires Ruby 2.0+
#!/usr/bin/env ruby
# Usage: wp-audit [options]
# -a, --all-plugins Show all plugins, not just outdated ones
# -c, --[no-]color Highlight outdated versions in colour
# -f, --format [format] Specify output format. Accepted values: html, term (Terminal output and colours), md (Markdown, no colours). term is default.
#
# Requires: Ruby >= 2.0; a Unix-like operating system (one that ships
# with `find`, `less`, and `diff`)
#
# Installation:
@MichaelPote
MichaelPote / himawari.ps1
Created February 3, 2016 19:11
Windows Powershell Script to download the latest image from the Himawari-8 satelite, combine the tiles into a single image, convert to jpg and then set as the desktop background.
#
# Himawari-8 Downloader
#
#
#
# This script will scrape the latest image from the Himawari-8 satellite, recombining the tiled image,
# converting it to a JPG which is saved in My Pictures\Himawari\ and then set as the desktop background.
#
# http://himawari8.nict.go.jp/himawari8-image.htm
#
@willwhitney
willwhitney / himawari.py
Last active November 30, 2022 17:47 — forked from celoyd/hi8-fetch.py
Fetch and untile tiled Himawari-8 images from the http://himawari8.nict.go.jp PNG endpoint, then set them as desktop background on OSX
import requests
import sys
from datetime import datetime, timedelta
import pytz
from PIL import Image
from StringIO import StringIO
import os
import logging
# python himawari.py
@ishanbakshi
ishanbakshi / parrotMessengerBot.js
Created July 29, 2016 13:18
A lambda function that acts like an fb messenger bot which pings back what you typed
'use strict';
console.log('Loading function');
var https = require('https');
var PAGE_TOKEN = "EAASI6Z**********<fb tokenKey>";
var VERIFY_TOKEN = "my_awesome_token";
/**
* Provide an event that contains the following keys:
*