Skip to content

Instantly share code, notes, and snippets.

@paulallies
paulallies / ajax.get.js
Created August 31, 2011 20:50
YUI3 Ajax GET
Y.io(uri, {
on: {
success: function (txnid, res) {
Y.one('#container').set('innerHTML', res.responseText);
},
failure: function (err, res) {
Y.log(res.status + ":" + res.statusText);
}
}
});
@elebescond
elebescond / gist:1433137
Created December 5, 2011 10:24
Generate a pot template from a wordpress theme - xgettext
find . -iname "*.php" > /tmp/my_theme_file_list.txt
# new template
xgettext --from-code=utf-8 -d my_theme -f /tmp/my_theme_file_list.txt --keyword=__ -o languages/my_theme.pot
# update template
xgettext --from-code=utf-8 -d my_theme -j -f /tmp/my_theme_file_list.txt --keyword=__ -o languages/my_theme.pot
@jrom
jrom / nginx.conf
Created February 7, 2012 17:14
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
<?php
// STEP 1: read POST data
// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
// Instead, read raw POST data from the input stream.
$raw_post_data = file_get_contents('php://input');
$raw_post_array = explode('&', $raw_post_data);
$myPost = array();
foreach ($raw_post_array as $keyval) {
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active August 16, 2024 17:33
Using Git with Subversion Mirroring for WordPress Plugin Development
@jlengstorf
jlengstorf / wordpress-itunes-feed.php
Created March 8, 2013 22:20
Adds iTunes podcasting tags to a WordPress RSS2 feed for post type "podcast"
<?php
/* BEGIN PODCASTING FILTER HOOKS */
function example_add_itunes_namespace( )
{
if (get_post_type()==='podcast') {
echo 'xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"';
}
}
@clanceyp
clanceyp / dabblet.css
Created June 27, 2013 14:18
slide down details list
/* slide down details list */
@keyframes slideDown {
0% {
opacity: 0;
height: 0;
}
100% {
opacity: 1;
height: 20px;
}
@hrpunio
hrpunio / tcx2gpx
Created July 24, 2013 09:46
Convert TCX (Garmin Edge) to GPX with gpsbabel
#!/bin/bash
# Convert TCX (Garmin Edge) to GPX with gpsbabel
# Usage: tcx2gpx tcx-file-name [-o gpx-file-name] -max 999
# -o -- gpx-file-name, if not given, computed from tcx-file-name (it is assumed YYYY-MM-DD*.tcx)
# -max -- produce simplified track with maximum 999 trkpoints
#
SIMPLIFY=""
if [ $# -eq 0 ]; then
@anastasop
anastasop / convopml
Created August 4, 2013 14:54
Transform an outline file in opml format to a nice html for viewing
#!/usr/bin/python
from __future__ import print_function
import sys, xml.parsers.expat, sys
import pystache
if len(sys.argv) != 3:
print('usage: convopml.py <opml file> <html file>', file = sys.stderr)
sys.exit(2)
@plentz
plentz / nginx.conf
Last active November 16, 2024 14:10
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048