Skip to content

Instantly share code, notes, and snippets.

View paulruescher's full-sized avatar

Paul Ruescher paulruescher

  • Rivian
  • Vancouver, BC
View GitHub Profile
@paulruescher
paulruescher / simple_html_dom.php
Created September 23, 2011 18:37
Not my work, I think it's originally from http://simplehtmldom.sourceforge.net/
<?php
/**
* Website: http://sourceforge.net/projects/simplehtmldom/
* Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/)
* Contributions by:
* Yousuke Kumakura (Attribute filters)
* Vadim Voituk (Negative indexes supports of "find" method)
* Antcs (Constructor with automatically load contents either text or file/url)
*
* all affected sections have comments starting with "PaperG"
@paulruescher
paulruescher / Extend Recent Posts
Created June 26, 2012 19:02
Used this to change the output of WordPress' Recent Posts Widget
/**
* Extend Recent Posts Widget
*
* Adds different formatting to the default WordPress Recent Posts Widget
*/
Class My_Recent_Posts_Widget extends WP_Widget_Recent_Posts {
function widget($args, $instance) {
@paulruescher
paulruescher / gist:3051599
Created July 5, 2012 05:50
Modify Contact Form 7 Form Output
add_filter( 'wpcf7_form_elements', 'rl_wpcf7_form_elements' );
function rl_wpcf7_form_elements( $content ) {
// global $wpcf7_contact_form;
$rl_pfind = '/<p>/';
$rl_preplace = '<p class="wpcf7-form-text">';
$content = preg_replace( $rl_pfind, $rl_preplace, $content, 2 );
return $content;
}
@paulruescher
paulruescher / Command Shortcuts
Last active December 12, 2015 08:09
Some useful Terminal commands
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + L Clears the Screen, similar to the clear command
Ctrl + U Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H Same as backspace
Ctrl + R Let’s you search through previously used commands
Ctrl + C Kill whatever you are running
Ctrl + D Exit the current shell
Ctrl + Z Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + W Delete the word before the cursor
@paulruescher
paulruescher / gist:4750980
Created February 10, 2013 20:40
Some SCSS that I'm using for setting up a circle class
$white : #FFF;
$off-white : #F7F7F7;
$light-grey : #EAEAEA;
$grey : #CCCCCC;
$darker-grey : #828282;
$dark-grey : #424242;
$off-black : #222;
$black : #000;
$light-blue : #45C6F0;
@paulruescher
paulruescher / gist:5026277
Created February 24, 2013 23:43
Set Ember Data Adapter URL
App.Store = DS.Store.extend({
revision : 11,
adapter : DS.RESTAdapter.create({
url : 'https://proposals.firebaseio.com'
}),
});
@paulruescher
paulruescher / gist:5034090
Created February 25, 2013 22:54
Convert hexadecimal color to rgba
/**
* Converts hexidecimal to rgb format
*/
function lab_hex_to_rgb( $hex, $opacity = 1 ) {
$hex = str_replace( '#', '', $hex );
// if in 3 digit format
if( strlen( $hex ) == 3) {
@paulruescher
paulruescher / gist:5106618
Created March 7, 2013 09:04
Remove File From Git Repository
git rm --cached myFile.ext
@paulruescher
paulruescher / gist:5224004
Created March 22, 2013 19:25
Twitter Feed
// Twitter Feed
add_shortcode( 'twitter', 'rl_twitter_feed' );
function rl_twitter_feed( $atts ) {
// Attributes
if( isset( $atts['handle'] ) )
$handle = $atts['handle'];
// Check transients
$body = get_transient( 'rl_twitter_data' );
#!/bin/bash
# backend/run
echo -n -e "\033]0;Rails\007"
foreman start
echo -n -e "\033]0;\007"