Skip to content

Instantly share code, notes, and snippets.

@matthewjackowski
matthewjackowski / txgh.yml
Last active February 26, 2016 14:26
Example txgh.yml for AWS
txgh:
github:
repos:
matthewjackowski/txgh-test-resources:
api_username: <%= 'matthewjackowski' %>
api_token: <%= 'Some Token' %>
push_source_to: <%= 'txgh-test-1' %>
branch: <%= 'master' %>
transifex:
projects:
@matthewjackowski
matthewjackowski / Message.php
Created March 30, 2016 08:53
Refactoring to Factory Function in PHP
<?php
/**
* Message object class used to control when messages are output
* @package Brilliantcoding
*/
/**
* Message Class
*/
@matthewjackowski
matthewjackowski / run-varnishd
Created April 2, 2016 20:07
Manually run a very small varnish
#!/bin/bash
set -e
exec bash -c \
"exec /usr/local/sbin/varnishd -F \
-a :80 \
-a :6443 \
-S /etc/varnish/secret \
-f /etc/varnish/default.vcl \
@matthewjackowski
matthewjackowski / appcache.vcl
Last active April 5, 2016 14:46
A basic vcl for the app
vcl 4.0;
# Default backend definition. Set this to point to your content server.
backend default {
.host = "wordpress";
.port = "80";
}
acl edgecache {
"172.31.12.197";
@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 / remove-translation-segmentation.rb
Created July 28, 2016 06:10
For XLIFF files - remove segmentation markup
#!/usr/bin/env ruby
require 'optparse'
require 'nokogiri'
# This will hold the options we parse
options = {}
# Build command line parser
OptionParser.new do |p|
@matthewjackowski
matthewjackowski / Dockerfile
Last active October 9, 2016 23:34
An opinionated Docker build for Txgh
FROM alpine:3.3
MAINTAINER Matthew Jackowski <matthew@transifex.com>
# Update and install all of the required packages.
# At the end, remove the apk cache
RUN apk update && \
apk upgrade && \
apk add bash curl-dev ruby-dev build-base && \
apk add ruby ruby-io-console ruby-bundler && \
rm -rf /var/cache/apk/*
@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 / Facade.py
Created June 10, 2017 17:21
Pythonic Facade
# ChangeInterface/Facade.py
class A:
def __init__(self, x): pass
class B:
def __init__(self, x): pass
class C:
def __init__(self, x): pass
# Other classes that aren't exposed by the
# facade go here ...
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
public class Main
{
public static void main(String[] args) {