Skip to content

Instantly share code, notes, and snippets.

View tbreuss's full-sized avatar

tebe tbreuss

View GitHub Profile
@tomschlick
tomschlick / Environments to bypass .htpasswd protection
Created November 8, 2009 08:30
This allows you to set certain urls/domains that are allowed to bypass a htpasswd protection layer, which is very useful for multiple environment setups (developement, staging, production)
#allows a single uri through the .htaccess password protection
SetEnvIf Request_URI "/testing_uri$" test_uri
#allows everything if its on a certain host
SetEnvIf HOST "^testing.yoursite.com" testing_url
SetEnvIf HOST "^yoursite.com" live_url
Order Deny,Allow
AuthName "Restricted Area"
AuthType Basic
(function($){
$.widget("ui.mywidget", {
options: {
autoOpen: true
},
_create: function(){
// by default, consider this thing closed.
@cowboy
cowboy / jquery.ba-simplewidget.js
Created October 28, 2010 19:21
jQuery simpleWidget: a super-simple stateful widget factory
/*!
* jQuery simpleWidget - v0.1pre - 10/28/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($,undefined){
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@branneman
branneman / Struct.php
Created May 2, 2011 09:53
PHP Struct class
<?php
class Struct
{
/**
* Define a new struct object, a blueprint object with only empty properties.
*/
public static function factory()
{
$struct = new self;
foreach (func_get_args() as $value) {
@rponte
rponte / log4j.properties
Created September 8, 2011 19:45
Log4j configuration example with multiple appenders
log4j.rootLogger=warn, stdout, DAILY
## Console Appender
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss} %5p [%-20c{1}] %m%n
## Daily Appender
log4j.appender.DAILY.Threshold=error
log4j.appender.DAILY=org.apache.log4j.DailyRollingFileAppender
<?php
namespace Pokus;
class Exception extends \Exception
{
}
function tttt($string)
{
try {
@mathiasprinz
mathiasprinz / clickoutside.js
Created December 20, 2011 07:52
Sample of a widget
/*!
* jQuery outside events - v1.1 - 3/16/2010
* http://benalman.com/projects/jquery-outside-events-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// Script: jQuery outside events
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@davelpz
davelpz / gist:1996353
Created March 7, 2012 21:27
jQuery Widget Template
# Name of Widget
# some general notes about purpose and usage
# naming convention is: ccWidgetName.coffee
# Getter and setter methods, return and chaining implications:
# There are two kinds of plugin functions: getters and setters.