Skip to content

Instantly share code, notes, and snippets.

View fmtarif's full-sized avatar

Faisal Muhammad fmtarif

View GitHub Profile
@fmtarif
fmtarif / gist:11402068
Created April 29, 2014 14:29
addthis buttons
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" style="height:85px;">
<a class="addthis_button_facebook"></a><!--FB share has issues with title and desc-->
<a class="addthis_button_twitter"></a>
<a class="addthis_button_pinterest_share"></a>
<a class="addthis_button_email"></a>
<a class="addthis_button_google_plusone_share"></a>
<a class="addthis_button_compact"></a>
</div>
@fmtarif
fmtarif / example-schema-def.php
Last active August 29, 2015 14:01
#php #mysql - mysql schema generator
<?php
// Set base database name
$DATABASE = 'sample';
// Automatically create primary key column for tables?
$AUTOSERIAL = true;
// Create log of changes (for advanced schema only)
$CHANGELOG = true;
@fmtarif
fmtarif / mysql-schema-gen.php
Last active August 29, 2015 14:01
#php #mysql modified the command line schema generator to be web based
<?php
//example config as ref
$conf = '
// Set base database name
$DATABASE = "sample";
// Automatically create primary key column for tables?
$AUTOSERIAL = true;
@fmtarif
fmtarif / typography-responsive-example.css
Created May 17, 2014 03:59
#css good example of responsive typography site
@font-face {
font-family:'PTSerifCustom';
src:url('../font/PTF55F_W.eot');
src:url('../font/PTF55F_W.eot?#iefix') format('embedded-opentype'), url('../font/PTF55F_W.woff') format('woff'), url('../font/PTF55F_W.ttf') format('truetype');
font-weight:normal;
font-style:normal
}
@font-face {
font-family:'PTSerifCustom';
src:url('../font/PTF56F_W.eot');
@fmtarif
fmtarif / modal-example.html
Last active August 29, 2015 14:01
#js lightweight modal/lightbox boilerplate
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="modal.css">
</head>
<body>
<h1><a class="js-modal-trigger" data-target-modal="#js-modal-1" href="javascript:;">Trigger Modal 1</a></h1>
@fmtarif
fmtarif / nested-ternary.php
Last active October 27, 2020 11:35
#php non obvious behavior of nested ternary
<?php
$arg = 'T';
$vehicle = ( $arg == 'B' ) ? 'bus' :
( $arg == 'A' ) ? 'airplane' :
( $arg == 'T' ) ? 'train' :
( $arg == 'C' ) ? 'car' :
( $arg == 'H' ) ? 'horse' :
'feet';
echo $vehicle;
@fmtarif
fmtarif / csv-2-array.php
Last active October 2, 2023 16:52
#php one liner csv to array
<?php
$data_arr = array_map("str_getcsv", preg_split('/\r*\n+|\r+/', file_get_contents("path/to/csv-file.csv")));
//or
$data_arr = array_map("str_getcsv", file("path/to/csv-file.csv")));
<?php
//https://www.inanimatt.com/php-curl.html
// See https://lazycat.org/php-curl.html for license & known issues
// P.S. You'd better have a very good reason for using this instead of http://guzzlephp.org/
function httpGet($url, $ttl = 86400)
{
/* Change this or make it an option as appropriate. If you're
* getting urls that shouldn't be visible to the public, put the
@fmtarif
fmtarif / ternary-nested.php
Created June 4, 2014 05:21
#php Taming nested ternary, nested ternary has behavior that is not always obvious
<?php
/**
* nested ternary quirk
*/
// will echo f not t, left to right association
echo true? 't' : false? 'f'
: 't';
@fmtarif
fmtarif / ini_set.php
Last active August 29, 2015 14:02
#php conf that are allowed in ini_set
<?php
/**
* http://www.php.net/manual/en/ini.list.php
*/
//PHP_INI_PERDIR Entry can be set in php.ini, .htaccess, httpd.conf or .user.ini (since PHP 5.3)
//PHP_INI_SYSTEM Entry can be set in php.ini or httpd.conf
//PHP_INI_ALL Entry can be set anywhere