Skip to content

Instantly share code, notes, and snippets.

View matthewjackowski's full-sized avatar

Matthew Jackowski matthewjackowski

View GitHub Profile
@matthewjackowski
matthewjackowski / Message.java
Created December 28, 2015 08:40
Refactored For-Loop to Lambda in Java
package com.brilliantcoding;
public class Message {
int type;
public Message(int type){
this.type = type;
}
public String toString() {
switch (this.type) {
case 0:
@matthewjackowski
matthewjackowski / refactor_to_strategy.js
Last active December 20, 2015 08:55
Refactor to Strategy in Javascript
var message = require('./lib/zmessage');
var Strategy = function(f) {
this.send = f;
};
Strategy.prototype.execute = function(m) {
this.send(m);
};
def handleAuthError
puts 'Put error handling code here'
end
project_params = {
slug: "test-#{SecureRandom.uuid}",
description: 'wpml_project',
organization: user_data[:org_slug],
:private => true,
source_language_code: 'en',
@matthewjackowski
matthewjackowski / angular-translate-basic-setup.js
Last active February 13, 2017 10:47
Basic App Setup for Angular Translate
var translations = {
"All": "All",
"Active": "Active",
"Completed": "Completed",
"Clear_Completed": "Clear_Completed"
};
var estranslations = {};
app.config(['$translateProvider', function ($translateProvider) {
@matthewjackowski
matthewjackowski / Demo-commands
Last active October 28, 2015 20:03
Commands for Javascript Demo
npm install connect serve-static
node server.js
var s = angular.element($0).scope();
s.changeLanguage('es');
@matthewjackowski
matthewjackowski / wp-cli.yml
Created October 3, 2015 22:05
WP CLI global config
apache_modules:
- mod_rewrite
@matthewjackowski
matthewjackowski / travisci-apache
Last active October 5, 2015 07:38
Apache conf for TravisCI
<VirtualHost *:80>
ServerName wptest.localhost
DocumentRoot %TRAVIS_BUILD_DIR%
<Directory "%TRAVIS_BUILD_DIR%">
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order deny,allow
Allow from all
RewriteEngine On
@matthewjackowski
matthewjackowski / wp-plugin-deploy.sh
Last active July 25, 2016 21:59
Deploy to plugin repo
#!/bin/bash
echo "$PLUGIN_VERSION"
rm -rf ./build
mkdir ./build
cd build
svn co https://plugins.svn.wordpress.org/transifex-live-integration
cd ./transifex-live-integration
rm -f ./trunk/*
# copy files
cp ../../index.php ./trunk
@matthewjackowski
matthewjackowski / install-wp-tests.sh
Last active May 8, 2022 10:45
Install Wordpress and Tests
#!/usr/bin/env bash
##
# This script installs wordpress for phpunit tests and rspec integration tests
##
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$(dirname ${DIR})
if [ $# -lt 3 ]; then
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version]"
exit 1
@matthewjackowski
matthewjackowski / posgresql-on-a-vagrant.md
Last active August 29, 2015 14:07
Postgresql on a Vagrant

For this Gist we'll be using Chef Kitchen: https://docs.getchef.com/kitchen.html

Which is a convient way to wrap together chef-solo, berkshelf, and vagrant.

Assuming a basic setup of Ruby to run Kitchen(I use rbenv and bundler to make life easier, but this might lead to some righteous Ruby debate...so foregoing here).

Enough preamble, here is my Gemfile:

source 'https://rubygems.org'