Skip to content

Instantly share code, notes, and snippets.

@kfatehi
kfatehi / nzb_import.rb
Created May 30, 2011 02:39
nn import script
#!/usr/bin/env ruby
=begin
Created by keyvan
#newznab on irc.synirc.net
This script is for importing a giant dump of NZB files into newznab. Be warned, it's HACKY!
1) I expect you have downloaded a big archive full of nzbs and have extracted it.
The directory structure should be like this:
dump/
MoviesHD/
@hoffstein
hoffstein / Default (Windows).sublime-keymap
Created July 18, 2011 15:08
Sublime Text 2 script to open the current file's parent directory in Windows Explorer
[
{ "keys": ["ctrl+shift+e"], "command": "open_folder_in_explorer" }
]
@mediabounds
mediabounds / floatsign.sh
Last active March 31, 2024 18:43
A small bash script to re-sign iOS applications.
# !/bin/bash
# Copyright (c) 2011 Float Mobile Learning
# http://www.floatlearning.com/
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
@mjangda
mjangda / remove-post-term.php
Created December 21, 2011 15:11
Remove a given term from the specified post. This function is missing from core WordPress.
<?php
/**
* Remove a given term from the specified post
*
* Helper function since this functionality doesn't exist in core
*/
function my_remove_post_term( $post_id, $term, $taxonomy ) {
if ( ! is_numeric( $term ) ) {
@hmert
hmert / jquery-profile.js
Created January 1, 2012 06:53
jQuery Profiling Plugin
/*
* http://ejohn.org/blog/deep-profiling-jquery-apps/
* use: call jQuery.displayProfile(); in firebug console
*/
(function(){var log=[];var handle=jQuery.event.handle,ready=jQuery.ready;var internal=false;var eventStack=[];var curEvent=log[0]={event:"inline",methods:[],duration:0};if(!jQuery.readyList)jQuery.readyList=[];jQuery.readyList.unshift(function(){if(curEvent&&curEvent.event=="inline"&&curEvent.methods.length==0){log.shift()}if(curEvent)eventStack.push(curEvent);var e=curEvent=log[log.length]={event:"ready",target:formatElem(document),methods:[]};var start=(new Date).getTime();jQuery(document).bind("ready",function(){e.duration=(new Date).getTime()-start;curEvent=eventStack.pop()})});jQuery.event.handle=function(event){var pos=log.length;if(curEvent)eventStack.push(curEvent);var e=curEvent=log[pos]={event:event.type,target:formatElem(event.target),methods:[]};var start=(new Date).getTime();var ret=handle.apply(this,arguments);e.duration=(new Date).getTime()-start;curEvent=eventStack.pop();if(e.me
@thulstrup
thulstrup / compass-retina-sprites.scss
Created March 20, 2012 19:18
Using Compass to generate normal and retina sprite maps
$sprites: sprite-map("sprites/*.png");
$sprites-retina: sprite-map("sprites-retina/*.png");
@mixin sprite-background($name) {
background-image: sprite-url($sprites);
background-position: sprite-position($sprites, $name);
background-repeat: no-repeat;
display: block;
height: image-height(sprite-file($sprites, $name));
width: image-width(sprite-file($sprites, $name));
@bradvin
bradvin / jQuery.loadScript
Created April 5, 2012 19:03
conditional load script helper function with jQuery
jQuery.loadScript = function (url, arg1, arg2) {
var cache = false, callback = null;
//arg1 and arg2 can be interchangable as either the callback function or the cache bool
if ($.isFunction(arg1)){
callback = arg1;
cache = arg2 || cache;
} else {
cache = arg1 || cache;
callback = arg2 || callback;
}
@alanhogan
alanhogan / compass-retina-sprites.scss
Created June 5, 2012 23:21 — forked from thulstrup/compass-retina-sprites.scss
Using Compass to generate normal and retina sprite maps
$sprites: sprite-map("sprites/*.png");
$sprites-retina: sprite-map("sprites-retina/*.png");
@mixin sprite-background($name) {
background-image: sprite-url($sprites);
background-position: sprite-position($sprites, $name);
background-repeat: no-repeat;
display: block;
height: image-height(sprite-file($sprites, $name));
width: image-width(sprite-file($sprites, $name));
@achimnol
achimnol / sqlite_backup.py
Created June 30, 2012 03:13
A simple and safe SQLite3 backup script written in Python using ctypes + sqlite3 online backup API
#! /usr/bin/env python
# Of course, the author does not guarantee safety.
# I did my best by using SQLite's online backup API.
from __future__ import print_function
import sys, ctypes
from ctypes.util import find_library
SQLITE_OK = 0
SQLITE_ERROR = 1
SQLITE_BUSY = 5
@mjangda
mjangda / allow-ids.php
Last active January 21, 2022 02:27
Don't let kses strip out ids from section tags
<?php
function x_allow_ids_on_tags() {
global $allowedposttags;
$tags = array( 'section', 'article' );
$new_attributes = array( 'id' => array() );
foreach ( $tags as $tag ) {
if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) )
$allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes );