Skip to content

Instantly share code, notes, and snippets.

View timkinnane's full-sized avatar

Tim Kinnane timkinnane

View GitHub Profile
@somatonic
somatonic / TextareaStripNbsp.module
Created April 9, 2014 23:45
Fix TinyMCE &nbsp chars, leaving those without a space in front intact
<?php
/**
* TinyMCE replace nbsp with regular whitespace
*
* Only nbsp preceeded with a whitespace will get replaced, this leaves
* single non breaking space only bewtween words
*
* ProcessWire 2.x
* Copyright (C) 2012 by Ryan Cramer
@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
@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({
@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
@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);
};
@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:
*
'use strict';
var https = require('https');
var PAGE_TOKEN = "EAAJ6****";
var VERIFY_TOKEN = "my_token******";
exports.handler = (event, context, callback) => {
// process GET request
if(event.params && event.params.querystring){
var queryParams = event.params.querystring;
var rVerifyToken = queryParams['hub.verify_token']
@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:
@mikaelmello
mikaelmello / draft.md
Last active April 25, 2018 17:01
Draft of GSoC 2018 proposal for Rocket.Chat

"Improve the integration of bots on Rocket.Chat" proposal for Google Summer of Code 2018

Personal Details

@sloped
sloped / paging.php
Created March 19, 2012 16:21
Bootstrap Paging and Wordpress
<?php
//Use this function to create pagingation links that are styleable with Twitter Bootstrap
function paging() {
global $wp_query;
$total_pages = $wp_query->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('paged'));