Skip to content

Instantly share code, notes, and snippets.

View mojowen's full-sized avatar
🍕
🤔

Scott Duncombe mojowen

🍕
🤔
View GitHub Profile
@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@MacMaru
MacMaru / wrap_view.py
Created July 31, 2011 16:59
Override Tastypie wrap_view() to return custom (JSON) response
class YourResource(ModelResource):
def wrap_view(self, view):
"""
Wraps views to return custom error codes instead of generic 500's
"""
@csrf_exempt
def wrapper(request, *args, **kwargs):
try:
@devpuppy
devpuppy / nokogiri libxml homebrew lion
Created November 8, 2011 23:26
How to fix: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
FIXME:
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
or
libxml_ruby.bundle: dlsym(0x10fde1900, Init_libxml_ruby): symbol not found
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@shimondoodkin
shimondoodkin / tinyxhr.js
Last active September 19, 2023 18:10
tiny xhr snippet to do XMLHttpRequest
// tinyxhr by Shimon Doodkin - licanse: public doamin - https://gist.github.com/4706967
//
// tinyxhr("http://site.com/ajaxaction",function (err,data,xhr){ if (err) console.log("goterr ",err,'status='+xhr.status); console.log(data) });
// tinyxhr("http://site.com/ajaxaction",function (err,data,xhr){ if (err) console.log("goterr ",err,'status='+xhr.status); console.log(data) },'POST','value1=1&value2=2');
// tinyxhr("http://site.com/ajaxaction.json",function (err,data,xhr){ if (err) console.log("goterr ",err,'status='+xhr.status); console.log(data); console.log(JSON.parse(data)) },'POST',JSON.stringify({value:1}),'application/javascript');
// cb - a callback function like: function (err,data,XMLHttpRequestObject){ if (err) throw err; }
//
function tinyxhr(url,cb,method,post,contenttype)
{
@whalesalad
whalesalad / Rakefile
Created August 6, 2013 17:01
Quick and dirty Rakefile for a Wordpress project I maintain. Automates the conversion of .po files to .mo files. In this example, it uses all the .po files in the ./lang directory. Also note that I installed gettext via homebrew so the msgfmt binary is not on my path. Rather than muck with my path and risk screwing up OS X's built-in gettext stu…
MSGFMT = "/usr/local/Cellar/gettext/0.18.2/bin/msgfmt"
task :export_mo do |t|
po_files = Dir.glob(File.dirname(__FILE__) + '/lang/*.po')
po_files.each do |po|
mo = po.gsub(/.po\Z/, '.mo')
sh "#{MSGFMT} -o '#{mo}' '#{po}'"
end
end
@kerryrodden
kerryrodden / .block
Last active November 5, 2024 20:24
Sequences sunburst
license: apache-2.0