Skip to content

Instantly share code, notes, and snippets.

View fmtarif's full-sized avatar

Faisal Muhammad fmtarif

View GitHub Profile
@treffynnon
treffynnon / Config.php
Created September 3, 2010 09:20
A PHP class to access a PHP array via dot notation
<?php
namespace Treffynnon;
/**
* A PHP class to access a PHP array via dot notation
* (Agavi http://www.agavi.org was the inspiration).
*
* This was hacked in to an existing codebase hence the
* global config array variable.
@ihumanable
ihumanable / Excel.php
Last active February 6, 2024 06:24
Simple Excel Writer in PHP
<?php
/**
* Simple excel writer class with no external dependencies, drop it in and have fun
* @author Matt Nowack
* @link https://gist.github.com/ihumanable/929039/edit
* @license Unlicensed
* @version 1.0
*/
class Excel {
/* match a string at the beginning of string */
SELECT 'Test' REGEXP '^The'; -- 0
SELECT 'The Test' REGEXP '^The'; -- 1
/* if a name is not prefixed with 'The ' then add it */
UPDATE [table]
SET Name = CONCAT('The ', TRIM(Name))
WHERE Name NOT REGEXP '^The'
/* copy a column from one table to another */
@jed
jed / LICENSE.txt
Created May 10, 2011 23:27 — forked from 140bytes/LICENSE.txt
calculate # of ms/seconds/minutes/hours/days in the past
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@dalethedeveloper
dalethedeveloper / gist:1042934
Created June 23, 2011 16:35
Backup bash script for Webserver DB + Site Files
#!/bin/bash
# http://www.ivorde.ro/How_to_backup_all_mysql_databases_with_one_command-51.html
# http://bash.cyberciti.biz/backup/backup-mysql-database-server-2/
# http://sgowtham.net/blog/2008/04/04/backing-up-and-restoring-mysql-databases/
# Requires: http://s3tools.org/s3cmd
MyUSER="YOUR-USERNAME"
MyPASS="YOUR-PASSWORD"
MyHOST="localhost"
@ocean90
ocean90 / box-shadow.html
Last active July 12, 2024 04:58
CSS3 Box Shadow, only top/right/bottom/left and all
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@ziadoz
ziadoz / awesome-php.md
Last active July 13, 2024 05:29
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@chrisguitarguy
chrisguitarguy / pmg-rewrite.php
Created February 11, 2012 00:41
WordPress rewrite tutorial
<?php
/*
Plugin Name: Rewrite Rule Tutorials
*/
add_action( 'init', 'pmg_rewrite_add_rewrites' );
function pmg_rewrite_add_rewrites()
{
add_rewrite_endpoint( 'json', EP_PERMALINK );
add_rewrite_rule(
@Gipetto
Gipetto / gist:1894045
Created February 23, 2012 17:59
Convert all category select checkboxes in to radio buttons in the WordPress post-edit screen.
// Convert all Category input checkboxes in to radio selects
// It completely replaces the elements with new ones and transfers
// the attributes from the old element to the new.
// We can't just change the type because of, you guessed it, Internet Explorer
// Yes, sometimes a hand grenade is easier than a scalpel ;)
jQuery('form#post').find('.categorychecklist input').each(function() {
var new_input = jQuery('<input type="radio" />'),
attrLen = this.attributes.length;
for (i = 0; i < attrLen; i++) {