Skip to content

Instantly share code, notes, and snippets.

@eojeel
eojeel / post-receive
Created March 12, 2019 09:19 — forked from lemiorhan/post-receive
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@eojeel
eojeel / WishlistMember folder Protection
Last active June 13, 2016 14:59
WishlistMember folder Protection, stops unwanted users accessing folders depending on level
require ('../../wp-blog-header.php');
require ('../../wp-content/plugins/wishlist-member/core/api-helper/class-api-methods.php');
$user_ID = get_current_user_id();
// replace level id
$check = wlmapi_is_user_a_member(**LEVEL_ID**, $user_ID);
if ( $check ) {
#echo 'User is a member';
header('Location: ***');
} else {
#echo 'User is not a member';
<script type="text/javascript" language="Javascript" src="/wp-content/themes/writeadultfiction/js/mailcheck.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
var domains = ["yahoo.com", "google.com", "hotmail.com", "gmail.com", "me.com", "aol.com", "mac.com",
"live.com", "comcast.net", "googlemail.com", "msn.com", "hotmail.co.uk", "yahoo.co.uk",
"facebook.com", "verizon.net", "mail.com", "outlook.com"];
var topLevelDomains = ["co.uk", "com", "net", "org", "info", "edu", "gov", "mil"];
var MailParser = require('mailparser').MailParser;
var Mbox = require('./src/mbox');
var mbox = new Mbox();
var fs = require('fs');
// wait for message events
mbox.on('message', function(msg) {
// parse message using MailParser
mailparser = new MailParser();
@eojeel
eojeel / test_wp_mail.php
Created April 5, 2016 09:25 — forked from butlerblog/test_wp_mail.php
File for testing the wp_mail function http://b.utler.co/9L
<?php
/**
* This file can be used to validate that the WordPress wp_mail() function is working.
* To use, change the email address in $to below, save, and upload to your WP root.
* Then browse to the file in your browser.
*
* For full discussion and instructions, see the associated post here:
* http://b.utler.co/9L
*
* Author: Chad Butler
@eojeel
eojeel / sns_to_slack.js
Last active May 11, 2016 16:05 — forked from aalbertson/sns_to_slack.js
AWS Lambda function for forwarding SNS notifications to Slack
const https = require('https');
const url = require('url');
// to get the slack hook url, go into slack admin and create a new "Incoming Webhook" integration
const slack_url = 'https://hooks.slack.com/services/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';
const slack_req_opts = url.parse(slack_url);
slack_req_opts.method = 'POST';
exports.handler = function(event, context) {
(event.Records || []).forEach(function (rec) {
@eojeel
eojeel / gist:367450ff76dbf939f2a8
Created December 30, 2015 10:45
HTML/CSS: Very Simple/Lightweight Breadcrumb
<style type="text/css">
.breadcrumb li {
display: inline;
}
.breadcrumb li+li:before {
content:"» ";
}
</style>
<ol class="breadcrumb">