Instantly share code, notes, and snippets.

View getInstagramPosts()
/**
* Fetch posts from Instagram
* Requires Access Token - http://mehimali.com.np/get-photos-from-instagram-using-php-curl/
*/
function getInstagramPosts($accessToken, $limit = 20){
$api_url = "https://api.instagram.com/v1/users/self/media/recent/?access_token=".$accessToken."&count=".$limit;
$connection_c = curl_init(); // initializing
curl_setopt( $connection_c, CURLOPT_URL, $api_url ); // API URL to connect
curl_setopt( $connection_c, CURLOPT_RETURNTRANSFER, 1 ); // Return the result, do not print
View Move Yoast SEO box to the bottom of the page.php
function yoasttobottom() {
return 'low';
}
add_filter( 'wpseo_metabox_prio', 'yoasttobottom');
View Rewrite Rule with custom page ID.php
// required functions
function get_id_by_slug($page_slug) {
$page = get_page_by_path($page_slug);
if ($page) {
return $page->ID;
} else {
return null;
}
}
function get_url_path(){
View Position Window Right.applescript
on run {input, parameters}
set front_app to (path to frontmost application as Unicode text)
tell application front_app
activate
#set bounds of window 1 to {1237, 30, 2437, 1350}
set bounds of window 1 to {1237, 57, 2437, 1325}
end tell
return input
end run
View Position Window Left.applescript
on run {input, parameters}
set front_app to (path to frontmost application as Unicode text)
tell application front_app
activate
#set bounds of window 1 to {8, 30, 1228, 1350}
set bounds of window 1 to {28, 57, 1207, 1325}
end tell
return input
end run
View Wordpress Page Speed.sh
Header unset Pragma
FileETag None
Header unset ETag
Options All -Indexes
<IfModule pagespeed_module>
ModPageSpeed on
ModPagespeedRewriteLevel CoreFilters
ModPagespeedEnableFilters prioritize_critical_css
View Admin Limiting Functions.php
/**
* Remove 1st level menu items
*/
function remove_menus () {
global $menu;
$restricted = array(__('Plugins'), __('Appearance'), __('Tools'), __('Settings'), __('Anxiety Institute'));
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
View Position Window Developer.applescript
on run {input, parameters}
set front_app to (path to frontmost application as Unicode text)
tell application front_app
activate
set bounds of window 1 to {8, 30, 1758, 1351}
#set bounds of window 1 to {28, 58, 1718, 1325}
end tell
return input
end run
View Jira Issue Collector.php
/**
* Add Jira Issue Collector code snippet
*
* Required in wp-config.php:
* define('JIRA_ISSUE_COLLECTOR_URL', '[URL]'); for DEV only
* define('JIRA_ISSUE_COLLECTOR_URL', false); for LIVE
*/
function wpb_add_jira_issue_collector(){
if(JIRA_ISSUE_COLLECTOR_URL){
View Obfuscate email address mailto links.php