Skip to content

Instantly share code, notes, and snippets.

View simonschaufi's full-sized avatar
👨‍💻

Simon Schaufelberger simonschaufi

👨‍💻
View GitHub Profile
<?php
$data = array(
array('company'=>'AIG', 'id'=>1, 'balance'=> '-$99,999,999,999.00'),
array('company'=>'Wachovia', 'id'=>2, 'balance'=> '-$10,000,000.00'),
array('company'=>'HP', 'id'=>3, 'balance'=> '$555,000.000.00'),
array('company'=>'IBM', 'id'=>4, 'balance'=> '$12,000.00')
);
$renderer = new ArrayToTextTable($data);
@tony-landis
tony-landis / array-to-texttable.php
Created December 3, 2008 08:00
PHP: Array to Text Table Generation Class
<?php
/**
* Array to Text Table Generation Class
*
* @author Tony Landis <tony@tonylandis.com>
* @link http://www.tonylandis.com/
* @copyright Copyright (C) 2006-2009 Tony Landis
* @license http://www.opensource.org/licenses/bsd-license.php
*/
class ArrayToTextTable
@nebiros
nebiros / mb_str_pad.php
Created November 4, 2009 20:30
mb_str_pad
<?php
/**
* mb_str_pad
*
* @param string $input
* @param int $pad_length
* @param string $pad_string
* @param int $pad_type
* @return string
@netzpirat
netzpirat / mass_mailer.rb
Created March 18, 2010 23:56
Send email to all email addresses from a MySQL table
#!/usr/bin/env ruby
#
# Send mass emails to the users of my small private email server
# with TLS.
#
# Queries the MySQL database for my vhost users and sends an
# email with ActionMailer to them.
#
# Install dependencies with `gem install mysql actionmailer`
#
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@marcgg
marcgg / gist:733592
Created December 8, 2010 17:26
Regex to get the Facebook Page ID from a given URL
# Matches patterns such as:
# https://www.facebook.com/my_page_id => my_page_id
# http://www.facebook.com/my_page_id => my_page_id
# http://www.facebook.com/#!/my_page_id => my_page_id
# http://www.facebook.com/pages/Paris-France/Vanity-Url/123456?v=app_555 => 123456
# http://www.facebook.com/pages/Vanity-Url/45678 => 45678
# http://www.facebook.com/#!/page_with_1_number => page_with_1_number
# http://www.facebook.com/bounce_page#!/pages/Vanity-Url/45678 => 45678
# http://www.facebook.com/bounce_page#!/my_page_id?v=app_166292090072334 => my_page_id
# http://www.facebook.com/my.page.is.great => my.page.is.great
@foertel
foertel / YourController.php
Created June 8, 2011 13:45
Turning Controller Method Argument Mapping into 404
<?php
/**
* @return void
*/
public function mapRequestArgumentsToControllerArguments() {
try {
parent::mapRequestArgumentsToControllerArguments();
} catch (Tx_Extbase_MVC_Exception_InvalidArgumentValue $exception) {
$GLOBALS['TSFE']->pageNotFoundAndExit();
}
@chikuzen
chikuzen / my_build.sh
Created September 2, 2011 13:09
How to compile libav/x264cli on windows
#!/bin/bash
# CAUTION!!! THIS SCRIPT IS NO WARRANTY!!!
: << _COMMENT_
How to compile libav/x264 binaries for both 32bit and 64bit on Windows
At first, you should install Git into your Windows.
1. Download Git from
http://msysgit.googlecode.com/files/Git-1.7.6-preview20110708.exe
@yano3
yano3 / gist:1378948
Created November 19, 2011 15:17
git commit --amend --reset-author
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
@deenseth
deenseth / gist:1514633
Created December 23, 2011 16:23
Add Google Calendar Event Bookmarklet
javascript: var s;
/*Figure out the selected text*/
if ( window.getSelection ) {
s = window.getSelection();
} else if ( document.getSelection ) {
s = document.getSelection();
} else {
s = document.selection.createRange().text;
}
/*If there isn't any text selected, get user input*/