Skip to content

Instantly share code, notes, and snippets.

View tonydjukic's full-sized avatar
🏠
Working from home

Tony Djukic tonydjukic

🏠
Working from home
View GitHub Profile
@robinnorth
robinnorth / wordpress_export-post-data.php
Created April 26, 2013 11:44
WordPress: Simple, configurable script to export post data to a CSV file
<?php
/**
* Export WordPress post data to CSV
* Based on <http://stackoverflow.com/a/3474698> and <http://ran.ge/2009/10/27/howto-create-stream-csv-php/>
*/
/**
*********************************************************************
* Configuration
*********************************************************************
@tommcfarlin
tommcfarlin / jquery-boilerplate.js
Created March 7, 2013 16:12
[WordPress] Properly loading jQuery within WordPress without having to use the `noConflict` method, or creating your own reference such as `$wp = jQuery`.
/**
* This gist demonstrates how to properly load jQuery within the context of WordPress-targeted JavaScript so that you don't
* have to worry about using things such as `noConflict` or creating your own reference to the jQuery function.
*
* @version 1.0
*/
(function( $ ) {
"use strict";
$(function() {
@alexjs
alexjs / cors-nginx.conf
Created November 28, 2012 22:42 — forked from michiel/cors-nginx.conf
Slightly tighter CORS config for nginx
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#
@THEtheChad
THEtheChad / normalize.css
Created March 27, 2012 16:24
Minified Normalize CSS Reset
/*! normalize.css 2012-02-07T12:37 UTC - http://github.com/necolas/normalize.css */article,aside,details,figcaption,figure,footer,header,hgroup,nav,section,summary{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}[hidden]{display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}html,button,input,select,textarea{font-family:sans-serif}body{margin:0}a:focus{outline:thin dotted}a:hover,a:active{outline:0}h1{font-size:2em;margin:.67em 0}h2{font-size:1.5em;margin:.83em 0}h3{font-size:1.17em;margin:1em 0}h4{font-size:1em;margin:1.33em 0}h5{font-size:.83em;margin:1.67em 0}h6{font-size:.75em;margin:2.33em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}blockquote{margin:1em 40px}dfn{font-style:italic}mark{background:#ff0;color:#000}p,pre{margin:1em 0}pre,code,kbd,samp{font-family:monospace,serif;_font-family:'courier new',monospace;font-size:1em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word
@jakebellacera
jakebellacera / http-auth-basic.md
Created January 9, 2012 21:18
How to secure a folder with Basic HTTP Authentication

Basic HTTP Authentication is when a user is required to log in to access a directory. This isn't meant to be secure by any means, but it's useful for locking out a majority of users from accessing a folder (e.g. staging a website).

To start, you must add this into your .htaccess:

AuthUserFile "/var/www/full/path/to/your/folder/.htpasswd"
AuthName "Message to go on user's login screen"
AuthType Basic
Allow from all
Require valid-user

Options +Indexes

@mikejolley
mikejolley / template-stock-report.php
Created December 5, 2011 20:18
WooCommerce - Stock Report. A template page snippet to (if you are logged in as admin) output a list of products/stock (which you are managing stock for) ready for printing.
<?php
/*
Template Name: Stock Report :)
*/
if (!is_user_logged_in() || !current_user_can('manage_options')) wp_die('This page is private.');
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@abraham
abraham / twitter.php
Created September 4, 2010 03:40
How to tweet with OAuth in three lines
<?php
// Download the latest version of TwitterOAuth from http://github.com/abraham/twitteroauth/downloads
// Unpack the download and place the twitteroauth.php and OAuth.php files in the same directory as this file.
// Register an application at http://dev.twitter.com/apps and from your new apps page get "my access token".
require_once('twitteroauth.php');
$connection = new TwitterOAuth('app consumer key', 'app consumer secret', 'my access token', 'my access token secret');
$status = $connection->post('statuses/update', array('status' => 'text to be tweeted'));