Skip to content

Instantly share code, notes, and snippets.

View tdmalone's full-sized avatar

Tim Malone tdmalone

View GitHub Profile
@mikeschinkel
mikeschinkel / redirect-old-urls.php
Created May 31, 2016 03:26
WordPress plugin to redirect old URLs when a site is refreshed. Uses a JSON file on activate to import into the DB. If Activation fails because of an error in the JSON file just deactivate, edit the file and then reactivate.
<?php
/**
* Plugin Name: Redirect Old URLs
* Description: Supports redirecting from an old site's URL to a new site on same domain.
* Version: 0.1.0
* Author: The WPLib Team
* Author URI: http://github.com/wplib
* Author Email: team@wplib.org
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
@MarZab
MarZab / Gruntfile.js
Last active May 20, 2017 18:23
comments for npm package.json with a grunt.js task
/*jslint node: true */
'use strict';
module.exports = function (grunt) {
/*
1. make package.json.js and export the json that will be saved as package.json
2. run grunt package.json, the new file will be written and you get a patch as well
*/
grunt.registerTask('package.json', function () {
This file has been truncated, but you can view the full file.
{"bulbasaur":{"base_stats":{"hp":45,"atk":49,"def":49,"spa":65,"spd":65,"spe":45},"name":{"en":"Bulbasaur","ja":"フシギダネ"},"type":["Grass","Poison"],"moves":{"tackle":{"type":"Normal","power":"50","accuracy":"100","category":"Physical","pp":35,"method":["level_up"]},"growl":{"type":"Normal","power":"0","accuracy":"100","category":"Status","pp":40,"method":["level_up"]},"leechseed":{"type":"Grass","power":"0","accuracy":"90","category":"Status","pp":10,"method":["level_up"]},"vinewhip":{"type":"Grass","power":"45","accuracy":"100","category":"Physical","pp":25,"method":["level_up"]},"poisonpowder":{"type":"Poison","power":"0","accuracy":"75","category":"Status","pp":35,"method":["level_up"]},"sleeppowder":{"type":"Grass","power":"0","accuracy":"75","category":"Status","pp":15,"method":["level_up"]},"takedown":{"type":"Normal","power":"90","accuracy":"85","category":"Physical","pp":20,"method":["level_up"]},"razorleaf":{"type":"Grass","power":"55","accuracy":"95","category":"Physical","pp":25,"method":["level_up"
This file has been truncated, but you can view the full file.
{
"bulbasaur": {
"base_stats": {
"hp": 45,
"atk": 49,
"def": 49,
"spa": 65,
"spd": 65,
"spe": 45
},
@ArturT
ArturT / .travis.yml
Last active July 12, 2017 01:40
Speed up Travis CI builds by caching the bundle to ftp. Based on s3 example: https://gist.github.com/matiaskorhonen/5203327 See README.md
---
language: ruby
rvm:
- 2.0.0
bundler_args: --without development --path=~/.bundle
env:
global:
- BUNDLE_ARCHIVE="app-bundle-archive"
- RAILS_ENV=test
- secure: "A_VERY_LONG_SERIES_OF_CHARACTERS_HERE"
@wags
wags / lint-shell-scripts.md
Created April 19, 2016 14:48
Lint Shell Scripts with Travis CI

Handy notes from this article.

git submodule add https://github.com/caarlos0/shell-travis-build.git build
cp build/travis.yml.example .travis.yml

Adds ShellCheck verification via Travis CI for any shell scripts in the repo.

Tricks to add encrypted private SSH key to .travis.yml file
To encrypt the private SSH key into the "-secure: xxxxx....." lines to place in the .travis.yml file, generate a deploy key then run: (to see what the encrypted data looks like, see an example here: https://github.com/veewee-community/veewee-push/blob/486102e6f508214b04414074c921475e5943f682/.travis.yml#L21
base64 --wrap=0 ~/.ssh/id_rsa > ~/.ssh/id_rsa_base64
ENCRYPTION_FILTER="echo \$(echo \"-\")\$(travis encrypt veewee-community/veewee-push \"\$FILE='\`cat $FILE\`'\" | grep secure:)"
split --bytes=100 --numeric-suffixes --suffix-length=2 --filter="$ENCRYPTION_FILTER" ~/.ssh/id_rsa_base64 id_rsa_
@creationix
creationix / bash-escape.js
Created April 26, 2012 20:08
Bash argument escaping
// Implement bash string escaping.
var safePattern = /^[a-z0-9_\/\-.,?:@#%^+=\[\]]*$/i;
var safeishPattern = /^[a-z0-9_\/\-.,?:@#%^+=\[\]{}|&()<>; *']*$/i;
function bashEscape(arg) {
// These don't need quoting
if (safePattern.test(arg)) return arg;
// These are fine wrapped in double quotes using weak escaping.
if (safeishPattern.test(arg)) return '"' + arg + '"';
#!/usr/bin/env php
<?php
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
package main
import (
"errors"
"fmt"
"io/ioutil"
"log"
"net"
"os"
"os/exec"