Skip to content

Instantly share code, notes, and snippets.

View fmtarif's full-sized avatar

Faisal Muhammad fmtarif

View GitHub Profile
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
* Tip: http://pivotallabs.com/users/jdean/blog/articles/1400-working-with-asynchronously-loaded-javascript
*/
(function(doc, script) {
var js,
@fmtarif
fmtarif / php-nuances
Last active August 29, 2015 14:02
#php nuances - stuff that are not quite obvious
Case sensitive VS insensitive
-------------------------------------------
From: http://stackoverflow.com/a/20624302/3540661
Case sensitive (both user defined and PHP defined)
variables
constants
array keys
@fmtarif
fmtarif / .htaccess
Created June 11, 2014 14:24
#htaccess List of all mod_rewrite variables
###### List of Mod_Rewrite Variables: http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html
###HTTP header variables:
#HTTP_USER_AGENT, HTTP_REFERER,
#HTTP_COOKIE, HTTP_FORWARDED, HTTP_HOST, HTTP_PROXY_CONNECTION, HTTP_KEEP_ALIVE
#HTTP_ACCEPT, HTTP_ACCEPT_CHARSET, HTTP_ACCEPT_ENCODING, HTTP_ACCEPT_LANGUAGE
#HTTP_CACHE_CONTROL, HTTP_CONNECTION
###Connection & request variables:
# REMOTE_ADDR, REMOTE_HOST, REMOTE_PORT, REMOTE_USER, REMOTE_IDENT
@fmtarif
fmtarif / breakpoints.css
Created July 1, 2014 10:44
#css breakpoints
/* css-tricks.com/snippets/css/media-queries-for-standard-devices/ */
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
$http({
method: 'GET',
url: endpoint,
params: {offset: offset, limit: limit},
/*alt - does the same thing
method: 'POST',
url: endpoint,
data: 'offset='+offset+'&limit='+limit,
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
@fmtarif
fmtarif / countries.json
Last active August 29, 2015 14:04 — forked from keeguon/countries.json
#ng #js
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@fmtarif
fmtarif / index.html
Last active August 29, 2015 14:06
#ng angular mock backend using $httpBackend
<!doctype html>
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular-mocks.js"></script>
<script>
var app = angular.module("app", ['ngMockE2E']);
//mock data for backend to respond with
@fmtarif
fmtarif / php.ini
Created September 24, 2014 18:11
#php common php.ini conf
upload_max_filesize = 2M
post_max_size = 8M ; Maximum size of POST data that PHP will accept.
memory_limit = 128M ; Maximum amount of memory a script may consume
max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data.
display_errors = Off
html_errors = On
log_errors = Off
@fmtarif
fmtarif / file-perms-linux.md
Last active October 23, 2017 15:19
#linux #cli File permissions - the confusing part
@fmtarif
fmtarif / ng-file-upload.html
Last active August 29, 2015 14:06
#ng angular file upload using HTML 5 File API
<!DOCTYPE html>
<html>
<!--From: http://uncorkedstudios.com/blog/multipartformdata-file-upload-with-angularjs -->
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.js"></script>
<script type="text/javascript">
var myApp = angular.module('myApp', []);
myApp.directive('fileModel', ['$parse', function ($parse) {
return {