Skip to content

Instantly share code, notes, and snippets.

@malfborger
malfborger / gist:1996616
Created March 7, 2012 22:15
jQuery: Get the latest
http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
@malfborger
malfborger / gist:1996631
Created March 7, 2012 22:18
Wordpress: Custom query loop
<?php $custom_query = new WP_Query('cat=-9'); // exclude category 9
while($custom_query->have_posts()) : $custom_query->the_post(); ?>
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<?php the_content(); ?>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); // reset the query ?>
@malfborger
malfborger / gist:2003891
Created March 8, 2012 22:33
Wordpress: Related posts
<?php
$tags = wp_get_post_tags($post->ID);
if ($tags) {
echo 'Related Posts';
$first_tag = $tags[0]->term_id;
@malfborger
malfborger / gist:3754856
Created September 20, 2012 09:17
JS: load async
(function(d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.src = '//third-party.com/resource.js';
s.parentNode.insertBefore(g, s);
}(document, 'script'));
#!/bin/bash
echo "This script will rebuild a Debian style package (deb) of latest stable"
echo "Nginx. The original deb is from nginx.org apt repository."
echo
echo "This will prompt you yes or no on a few changes to the build as well as"
echo "it will compile and package the latest Google NGX Pagespeed module."
echo
echo "This is built and tested on Ubuntu 14.04 LTS, fresh OS install."
echo "There are no guarantees, and I take no liability if it breaks, but it"
@malfborger
malfborger / ps.sh
Last active August 29, 2015 14:24 — forked from peter-mcconnell/ps.sh
NGINX_VERSION=1.8.0
NPS_VERSION=1.9.32.4
sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev unzip
sudo apt-get update
sudo apt-get upgrade
cd $HOME
wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
# Path to your oh-my-zsh installation.
export ZSH=/home/deploy/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.
@malfborger
malfborger / CSGO config
Last active February 6, 2016 16:35
CSGO config
unbindall
bind "0" "slot10"
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3"
bind "4" "slot4"
bind "5" "slot5"
bind "6" "slot6"
bind "7" "slot7"
bind "8" "slot8"