Skip to content

Instantly share code, notes, and snippets.

Paul pablopaul

View GitHub Profile
@purp
purp / README.md
Last active Jul 15, 2020
Debug Travis CI config locally using Docker
View README.md

Debugging Travis CI locally using Docker

This assumes you've got docker-machine installed, running, and can do docker run

1. Get a debug instance running

    docker run --name travis-debug -dit quay.io/travisci/travis-ruby /sbin/init
    docker exec -it travis-debug bash -l
@dreyescat
dreyescat / index.html
Created Dec 18, 2015
Webpack config to expose bundle in a variable in the global context
View index.html
<html>
<head>
</head>
<body>
<script src="lib/yourlib.js"></script>
<script>
window.onload = function () {
EntryPoint.run();
};
</script>
@jbinto
jbinto / index.jsx
Created Nov 28, 2015
Egghead tutorial - Getting Started with Redux - JSBin implementation
View index.jsx
/* global ReactRedux, Redux, ReactDOM */
// "Getting Started with Redux" (by Dan Abramov)
// https://egghead.io/series/getting-started-with-redux
// This file on JSBin (by Jesse Buchanan):
// http://jsbin.com/wuwezo/74/edit?js,console,output
////////////////////////////////////////////////
//
@ultimatemember
ultimatemember / gist:5f093ac300baa1d2a5f1
Last active Oct 25, 2018
Example: block any registration that does not use @gmail as mail provider
View gist:5f093ac300baa1d2a5f1
/*
The following code will require @gmail.com as domain
for user registrations.
You can change @gmail.com to any provider you want.
The code below requires a user email to be collected during registration
*/
add_action('um_before_new_user_register', 'require_google_email_for_signup');
@ultimatemember
ultimatemember / gist:6c8d18b2b0869662d203
Last active Aug 29, 2015
Check when user updates e-mail via account page
View gist:6c8d18b2b0869662d203
add_action('um_account_pre_update_profile', 'did_user_change_email', 10, 2 );
function did_user_change_email( $changes, $user_id ) {
$data = get_userdata($user_id);
if ( isset( $changes['user_email'] ) && $data->user_email != $changes['user_email'] ) {
// user e-mail changed! Do something
}
}
@agarzon
agarzon / DbHelper.php
Last active Jul 21, 2020
Codeception DB helper to extend database functionalities (update & delete)
View DbHelper.php
<?php
namespace Codeception\Module;
/**
* Additional methods for DB module
*
* Save this file as DbHelper.php in _support folder
* Enable DbHelper in your suite.yml file
* Execute `codeception build` to integrate this class in your codeception
*/
@SteveBenner
SteveBenner / unbrew.rb
Last active Jul 13, 2020
Homebrew uninstall script
View unbrew.rb
#!/usr/bin/env ruby
#
# CLI tool for locating and removing a Homebrew installation
# http://brew.sh/
#
# Copyright (C) 2014 Stephen C. Benner
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@inspectorfegter
inspectorfegter / psuedo-static-js.php
Last active Apr 7, 2017
Add a pseudo static JS file to WordPress
View psuedo-static-js.php
<?php
#Add a query var to sniff requests
add_filter( 'query_vars', 'my_query_var_callback', 10, 1 );
function my_query_var_callback( $vars ){
$vars[] = 'dynamic_js';
return $vars;
}
#Dynamic JavaScript
add_rewrite_rule( '^assets/js/dynamic\.js$', 'index.php?dynamic_js=1', 'top' ); //Note the hidden query variable
View plugin-deploy.sh
#!/bin/bash
# args
MSG=${1-'deploy from git'}
BRANCH=${2-'trunk'}
# paths
SRC_DIR=$(git rev-parse --show-toplevel)
DIR_NAME=$(basename $SRC_DIR)
DEST_DIR=~/Sites/wp-plugins/$DIR_NAME/$BRANCH
@remy
remy / batcharge.py
Last active Apr 27, 2020
My zsh set up as of July 25, 2013
View batcharge.py
#!/usr/bin/env python
# saved to ~/bin/batcharge.py and from
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/#my-right-prompt-battery-capacity
#!/usr/bin/env python
# coding=UTF-8
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]
You can’t perform that action at this time.