Skip to content

Instantly share code, notes, and snippets.

View Trippnology's full-sized avatar

Trippnology Trippnology

View GitHub Profile
@Trippnology
Trippnology / comments.php
Created October 12, 2015 13:36
WP: Add Bootstrap classes to comment form
// Add to your theme's comments.php
<?php
$comment_args = array(
'class_submit' => 'btn btn-default submit',
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <textarea id="comment" name="comment" class="form-control" cols="45" rows="8" aria-required="true" required="required"></textarea></p>',
'fields' => array(
'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
'<input id="author" name="author" class="form-control" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . $html_req . ' /></p>',
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
'<input id="email" name="email" class="form-control" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_auth
@Trippnology
Trippnology / .htaccess
Created February 16, 2015 12:22
Block SEMalt botnet
# Source: http://www.marketingpilgrim.com/2014/08/tips-for-blocking-semalt-and-botnet-attacks.html
# Block SEMalt botnet
SetEnvIfNoCase Referer fbdownloader.com spammer=yes
SetEnvIfNoCase Referer descargar-musicas-gratis.com spammer=yes
SetEnvIfNoCase Referer baixar-musicas-gratis.com spammer=yes
SetEnvIfNoCase Referer savetubevideo.com spammer=yes
SetEnvIfNoCase Referer srecorder.com spammer=yes
SetEnvIfNoCase Referer kambasoft.com spammer=yes
SetEnvIfNoCase Referer semalt.com spammer=yes
@Trippnology
Trippnology / README.md
Last active January 2, 2016 13:23
Default README.md

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@Trippnology
Trippnology / gist:11268174
Last active August 29, 2015 14:00
Twitter Profile Compactor
@-moz-document domain("twitter.com") {
p[class*="TweetTextSize--"] {
margin-bottom: 0;
font-size: 16px !important;
line-height: 1.333 !important; }
}
@Trippnology
Trippnology / wp-remove-generator-meta.php
Created November 21, 2013 17:15
WP: Remove generator meta tag
remove_action('wp_head', 'wp_generator');
@Trippnology
Trippnology / linux-tips-and-tricks.txt
Created November 15, 2013 13:19
Linux: Tips and Tricks
I have marked with a * those which I think are absolutely essential
Items for each section are sorted by oldest to newest. Come back soon for more!
BASH
* In bash, 'ctrl-r' searches your command history as you type
- Input from the commandline as if it were a file by replacing
'command < file.in' with 'command <<< "some input text"'
- '^' is a sed-like operator to replace chars from last command
'ls docs; ^docs^web^' is equal to 'ls web'. The second argument can be empty.
* '!!:n' selects the nth argument of the last command, and '!$' the last arg
@Trippnology
Trippnology / Fade-off-the-bottom-of-an-image.markdown
Created October 18, 2013 12:45
CSS: Fade off the bottom of an image

Fade off the bottom of an image

This looks like a good way to limit the height of a dynamic image (perhaps user submitted).

A Pen by Trippnology on CodePen.

License.

@Trippnology
Trippnology / gist:5676581
Created May 30, 2013 08:47
Blogger dynamic views jump menu
<script>
function openDir( form ) {
var newIndex = form.blogviewselect.selectedIndex;
if ( newIndex == 0 ) {
alert( "Please select a view" );
}
else {
cururl = form.blogviewselect.options[ newIndex ].value;
window.location.assign( cururl );
}
@Trippnology
Trippnology / gist:5671947
Created May 29, 2013 17:06
Facebook like button that validates. Now outdated, see http://developers.facebook.com/docs/reference/plugins/like/
<script type="text/javascript">
//<![CDATA[
(function() {
document.write('<fb:like width="200"></fb:like>');
var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://connect.facebook.net/en_US/all.js#xfbml=1';
s1.parentNode.insertBefore(s, s1);
})();
@Trippnology
Trippnology / cut-the-mustard.js
Created May 16, 2013 19:51
JS: BBC "Cutting the mustard" test
// http://responsivenews.co.uk/post/18948466399/cutting-the-mustard
if('querySelector' in document
&& 'localStorage' in window
&& 'addEventListener' in window) {
// bootstrap the javascript application
}