Skip to content

Instantly share code, notes, and snippets.

View mtinra's full-sized avatar

Mana Tinratreengam mtinra

  • Phuket, Thailand
View GitHub Profile

Facebook

http://www.facebook.com/sharer.php?u=URL

All other data will be fetched from open graph meta tags

<meta property="og:url" content="URL" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Content" />
@mtinra
mtinra / .htaccess
Created March 17, 2017 17:40 — forked from ScottPhillips/.htaccess
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/
@mtinra
mtinra / isnumber.js
Created November 17, 2016 03:16
Check input is number angularjs
//http://stackoverflow.com/a/31558451/4364777
if ( !isNaN(inputVar) && angular.isNumber(+inputVar)) {
//do somthing...
}
@mtinra
mtinra / gist:23658af563742d487005
Created February 16, 2016 05:10 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@mtinra
mtinra / laravel5_shared_hosting_project.sh
Created January 18, 2016 20:28 — forked from meganlkm/laravel5_shared_hosting_project.sh
setup a laravel5 project to deploy to a shared hosting provider
#!/bin/bash
myproject='myproject'
mywww='public_html'
# initialize project
composer create-project laravel/laravel $myproject --prefer-dist
cd $myproject
# fix paths to public
@mtinra
mtinra / location
Last active December 14, 2015 19:08
Adobe Illustrator user preferences location
Windows: - C:\Users\<user name>\AppData\Roaming\Adobe\Adobe Illustrator 19 Settings\en_US\x64\
Mac OS :- Users\<user name>\library\preferences\Adobe Illustrator 19 Settings\en_US\
wget http://wordpress.org/latest.tar.gz
tar xfz latest.tar.gz
mv wordpress/* ./
rmdir ./wordpress/
rm -f latest.tar.gz
@mtinra
mtinra / wp-config.php
Last active November 24, 2015 11:18
Disable Post Revisions in Wordpress
<?php
/** Limit the number of post revisions */
define( 'WP_POST_REVISIONS', 5 );
/** Completely Disable Post Revisions */
define('WP_POST_REVISIONS', false );
/** Set Autosave Interval to 1 hour */
define('AUTOSAVE_INTERVAL', 3600 );
?>
@mtinra
mtinra / OpenWithSublimeTextAsAdmin.bat
Last active September 20, 2015 11:53 — forked from jcppkkk/OpenWithSublime.bat
Add context menu to allow user open file or folder with Sublime as User or Admin. Save the raw file OpenWithSublimeTextAsAdmin.bat into sublime folder and execute it.
@echo off
@rem \"%stPath%\" : Path to Sublime Text installation dir.
@rem %UserEntry%: Key name for the registry entry.
@rem %UserMenuText% : Context menu text. Set your preferred menu text (e.g.: translate to your language).
@rem %AdminEntry%: Key name for the registry entry.
@rem %AdminMenuText% : Context menu text. Set your preferred menu text for administrator privilege (e.g.: translate to your language).
SET stPath=%~dp0sublime_text.exe
SET UserEntry=Sublime Text
SET AdminEntry=Sublime Text As Admin
@mtinra
mtinra / CSS Tabs - Transitioning Between Variable Heights.markdown
Created July 7, 2015 13:23
CSS Tabs - Transitioning Between Variable Heights