Skip to content

Instantly share code, notes, and snippets.

View frozzare's full-sized avatar
😎
Focusing

Fredrik Forsmo frozzare

😎
Focusing
View GitHub Profile
sudo apt-get update
sudo apt-get install libsqlite3-dev libsqlite3-ruby
sudo gem install mailcatcher --no-ri --no-rdoc
echo 'alias mailcatcher="mailcatcher --http-ip 192.168.66.6"' >> ~/.bashrc
source ~/.bashrc
<?php
add_filter('template', 'change_theme');
add_filter('option_template', 'change_theme');
add_filter('option_stylesheet', 'change_theme');
function change_theme () {
$domain = $_SERVER['HTTP_HOST'];
switch ($domain) {
case 'dev.wordpress.org':
<?php
/**
* Plugin Name: Static Templates
*
* If most of your site content is in .php template files, and you're tired of
* creating new pages, assigning them page templates, creating page templates
* then doing it all over again on production, this plugin is for you.
*
* Examples:
*
<?php
function sort_posts( $posts, $orderby, $order = 'ASC', $unique = true ) {
if ( ! is_array( $posts ) ) {
return false;
}
usort( $posts, array( new Sort_Posts( $orderby, $order ), 'sort' ) );
// use post ids as the array keys
if ( $unique && count( $posts ) ) {
#!/bin/bash
# Set the ROOM_ID & AUTH_TOKEN variables below.
# Further instructions at https://www.hipchat.com/docs/apiv2/auth
ROOM_ID=XXX
AUTH_TOKEN="XXX"
MESSAGE="Hello world!"
curl -H "Content-Type: application/json" \
<?php
// rewrite /wp-content/themes/theme-name/css/ to /css/
// rewrite /wp-content/themes/theme-name/js/ to /js/
// rewrite /wp-content/themes/theme-name/img/ to /img/
// rewrite /wp-content/plugins/ to /plugins/
function roots_flush_rewrites() {
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
RewriteRule ^wp(?:\/|)$ /wp/wp-login.php [QSA,L]
<?php
class PTB_Standard_Page extends PTB_Base {
public static $page_type = array(
'name' => 'Standard Page',
'description' => 'Description of standard page',
'template' => 'pages/standard-page.php'
);
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
<?php
class About_Us_Page_Type extends Papi_Page_Type {
/**
* Define our Page Type meta data.
*
* @return array
*/