Skip to content

Instantly share code, notes, and snippets.

@purp
purp / README.md
Last active August 12, 2021 20:49
Debug Travis CI config locally using Docker

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 December 18, 2015 18:02
Webpack config to expose bundle in a variable in the global context
<html>
<head>
</head>
<body>
<script src="lib/yourlib.js"></script>
<script>
window.onload = function () {
EntryPoint.run();
};
</script>
@jbinto
jbinto / index.jsx
Created November 28, 2015 22:15
Egghead tutorial - Getting Started with Redux - JSBin implementation
/* 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 October 25, 2018 01:50
Example: block any registration that does not use @gmail as mail provider
/*
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 August 29, 2015 14:15
Check when user updates e-mail via account page
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 January 1, 2022 08:49
Codeception DB helper to extend database functionalities (update & delete)
<?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 January 3, 2024 01:44
Homebrew uninstall script
#!/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
@retgef
retgef / psuedo-static-js.php
Last active April 7, 2017 22:00
Add a pseudo static JS file to WordPress
<?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
#!/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 March 6, 2024 00:57
My zsh set up as of July 25, 2013
#!/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]