Skip to content

Instantly share code, notes, and snippets.

@stevenkellow
stevenkellow / shortcuts.xml
Created May 30, 2017 08:22
Notepad++ Character fixer
<NotepadPlus>
<InternalCommands />
<Macros>
<Macro name="Character fixer" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="&#x2019;" />
<Action type="3" message="1625" wParam="0" lParam="1" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="&apos;" />
<Action type="3" message="1702" wParam="0" lParam="768" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
@stevenkellow
stevenkellow / ninja-forms-password-fix.js
Last active March 10, 2017 18:13
Ninja Forms password hotfix
var pass = document.getElementById("nf-field-3");
pass.type = 'password';
body{background:#1a2835;color:#fff}.bird-topbar-etched{color:#fff}.bird-topbar-etched:hover{color:#1da1f2}.global-nav .search-input{color:#fff!important;background-color:#444!important;border:1px solid #666;border-radius:3px!important;-moz-border-radius:0}#global-actions > li > a{border-bottom-color:#fff}#global-actions > li:hover > a,#global-actions > li > a:focus,.nav.right-actions > li > a:hover,.nav.right-actions > li > button:hover,.nav.right-actions > li > a:focus,.nav.right-actions > li > button:focus{color:#fff}.tweet-btn,.tweet-btn:focus{background-color:#444;background:rgba(81,82,83,0.8)}.module{border-radius:0!important;-moz-border-radius:0}.module .flex-module{background-color:#1a2835}.home-tweet-box,.RetweetDialog-commentBox,.WebToast-box--altColor,.content-main .conversations-enabled .expansion-container .inline-reply-tweetbox{background-color:#1a2835}.top-timeline-tweetbox .timeline-tweet-box{border-radius:0;-moz-border-radius:0;border:1px solid #333}.stream-item:not(.no-header-background-modul
#global-actions > li > a {
border-bottom-color: #fff;
}
#global-actions > li:hover > a, #global-actions > li > a:focus, .nav.right-actions > li > a:hover, .nav.right-actions > li > button:hover, .nav.right-actions > li > a:focus, .nav.right-actions > li > button:focus {
color: #fff;
}
#global-tweet-dialog .modal-tweet .tweet:hover, #global-tweet-dialog .modal-tweet .tweet {
background: #222 ;
@stevenkellow
stevenkellow / 2.x.php
Last active March 10, 2017 10:39
Ninja Forms user create
<?php
// Create user after form has been sanitised
add_action('ninja_forms_post_process', 'nf_create_user');
function nf_create_user(){
// Call in Ninja Forms
global $ninja_forms_processing;
// Get the form ID
$form_id = $ninja_forms_processing->get_form_ID();
@stevenkellow
stevenkellow / woocommerce-order-referrer.php
Created June 23, 2016 08:42
Add Referrer to WooCommerce order
<?php
// Set cookie for new users
add_action( 'init', 'set_newuser_cookie'); // Run when WordPress loads
function set_newuser_cookie() {
$cookie_value = $_SERVER["HTTP_REFERER"]; // Get URL the user came to your site for
if ( !is_admin() && !isset($_COOKIE['origin'])) { // If not an admin or if cookie doesn't exist already
setcookie( 'origin', $cookie_value, time()+3600*24*30, COOKIEPATH, COOKIE_DOMAIN, false); // Set cookie for 30 days
}
@stevenkellow
stevenkellow / email-cleaner.php
Created May 11, 2016 11:43
Fix common spelling mistakes in email addresses
<?php
$hotmail_string = "[email protected]";
$gmail_string = "[email protected]";
// Array of misspelled email address parts
$hotmail_wrong = array('hitmail', 'hitnail', 'hotnail', 'hotmain', 'hitmain');
$gmail_wrong = array('gmali.com', 'gmail.co.uk', 'gamil.com');
// Check all hotmail versions
foreach($hotmail_wrong as $h_check){
@stevenkellow
stevenkellow / email-splitter.js
Last active April 25, 2016 07:37
Get names from email address
document.getElementById('email').onchange=get_names; // When an input with id email is completed we can get to work!
function get_names(){ // Calls function
var email = document.getElementById('email').value; // Gets what was entered into email e.g [email protected]
var parts = email.split("@"); // Splits the email at the @ symbol
var username = parts[0]; // Can be used as a username if you'd like, but we'll use it to find names anyway
var delimiters = [".", "-", "_"]; // List of common email name delimiters, feel free to add to it
@stevenkellow
stevenkellow / javascript_resources.md
Last active August 29, 2015 14:22 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage