Skip to content

Instantly share code, notes, and snippets.

View noahbass's full-sized avatar

Noah Bass noahbass

View GitHub Profile
@noahbass
noahbass / protect-wp-login.php
Last active December 19, 2015 00:29
protect and redirect failed wordpress logins in the wp-login.php
<?php
// redirects and failed login attempts to the FBI cyber intelligence thingy
// adapted from http://css-tricks.com/snippets/htaccess/shock-teenage-gangsters-with-wp-config-redirect/
add_filter('login_redirect', 'catch_login_error', 10, 3);
function catch_login_error($redir1, $redir2, $wperr_user){
if(!is_wp_error($wperr_user) || !$wperr_user->get_error_code()) return $redir1;
switch($wperr_user->get_error_code()){
case 'incorrect_password':
case 'empty_password':
case 'invalid_username':
@noahbass
noahbass / better-wp-excerpts.php
Last active December 18, 2015 23:39
Better WordPress Excerpts
<?php
// better WordPress excerpts
// Usage: echo get_excerpt(250); (replace 250 with the number of characters)
function get_excerpt($count) {
$excerpt = get_the_content();
$excerpt = strip_tags($excerpt);
$excerpt = strip_shortcodes($excerpt);
$excerpt = substr($excerpt, 0, $count);
$excerpt = rtrim($excerpt, '.');
@noahbass
noahbass / wordpress-bootstrap-gruntfile.js
Created May 24, 2013 21:34
A starter Gruntfile for use with WordPress Bootstrap by 320press.
module.exports = function(grunt){
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: {
production: {
files: {
"library/less/bootstrap.less": "library/css/bootstrap.css"
}
}
},
@noahbass
noahbass / airmech-launcher
Created April 27, 2013 17:18
A method to launch Airmech through an Applescript.
tell application "Google Chrome"
activate
open location "chrome-extension://hdahlabpinmfcemhcbcfoijcpoalfgdn/AirMech.html#"
end tell
@noahbass
noahbass / web-robot.applescript
Last active December 15, 2015 21:09
A simple webpage clicking robot script.
(*
Inscructions:
Change Safari to your selection of browser
Change nameOrIDofButton to the ID or Name of the button to be selected, find this in your dev tools. If you don't know what this es, you probably shouldn't try to use this
Then replace http://example.com with the url you want to be refreshed
*)
repeat 3 times
tell application "Safari"
do JavaScript "document.all(\"nameOrIDofButton\").click()" in document 1
delay 1