Skip to content

Instantly share code, notes, and snippets.

View nucab's full-sized avatar
🏠
Working from home

Noah U nucab

🏠
Working from home
  • Philippines
  • 13:36 (UTC +08:00)
  • LinkedIn in/nucab
View GitHub Profile
@nucab
nucab / facebook_like-box_responsive.css
Created September 6, 2016 15:31 — forked from smeranda/facebook_like-box_responsive.css
Flexible width layout for Facebook Like Box/Activity Stream to use in Responsive Designs
/*
Make the Facebook Like box responsive (fluid width)
https://developers.facebook.com/docs/reference/plugins/like-box/
*/
/* This element holds injected scripts inside iframes that in some cases may stretch layouts. So, we're just hiding it. */
#fb-root {
display: none;
}
@nucab
nucab / gist:44cade068aaab17bb120e0b298c60814
Created September 17, 2016 08:59 — forked from frankiejarrett/gist:5544469
Return an attachment ID using a URL in WordPress
<?php
/**
* Return an ID of an attachment by searching the database with the file URL.
*
* First checks to see if the $url is pointing to a file that exists in
* the wp-content directory. If so, then we search the database for a
* partial match consisting of the remaining path AFTER the wp-content
* directory. Finally, if a match is found the attachment ID will be
* returned.
*
@nucab
nucab / Google Docs Script
Created October 21, 2016 05:40 — forked from tomcritchlow/Google Docs Script
The Google Spreadsheets Script Used To Call Social Media APIs
function FBshares(url) {
var jsondata = UrlFetchApp.fetch("http://graph.facebook.com/"+url);
var object = Utilities.jsonParse(jsondata.getContentText());
return object.shares;
}
function Tweets(url) {
var jsondata = UrlFetchApp.fetch("http://urls.api.twitter.com/1/urls/count.json?url="+url);
var object = Utilities.jsonParse(jsondata.getContentText());
return object.count;
@nucab
nucab / webpack.config.js
Created November 1, 2016 04:17 — forked from learncodeacademy/webpack.config.js
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
https://wordpress.org/support/topic/w3-total-cache-how-to-disable-minify-css-in-a-particular-template/
Well, just add this line at the top of the template page :
define('DONOTMINIFY', true);
@nucab
nucab / available_font-awesome_icons.php
Created November 19, 2016 19:28 — forked from gubi/available_font-awesome_icons.php
Get all icons from a font-awesome.css file and list in json mode
<?php
/**
* Available Font Awesome icons
*
* Get all icons from a font-awesome.css file and list in json mode
*
* @author Alessandro Gubitosi <[email protected]>
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License, version 3
*/
/**
* Gets an attachement image as lazy loaded img based on ID
* @param string $size Thumbnail, medium, large, original, or {custom size}
* @param string $class CSS class name for the img tag
* @param integer $attachment_id ID of the attachment
* @param string $attachment_id The custom src atrribute to use, default to data-echo
* @return string Lazyload friendly HTML img tag
*/
function get_attachemt_lazy($attachment_id = "", $size, $class, $src_attr = "data-echo")
{
<?php
add_filter( 'theme_page_templates', 'child_theme_remove_page_template' );
/**
* Remove page templates inherited from the parent theme.
*
* @param array $page_templates List of currently active page templates.
*
* @return array Modified list of page templates.
*/
function child_theme_remove_page_template( $page_templates ) {
@nucab
nucab / functions.php
Created January 8, 2017 19:11 — forked from tripflex/functions.php
WordPress Remove Filter (remove_filter converted to remove_class_filter) to remove Filter/Action without Class Object access. Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
<?php
/**
* Remove Class Filter Without Access to Class Object
*
* In order to use the core WordPress remove_filter() on a filter added with the callback
* to a class, you either have to have access to that class object, or it has to be a call
* to a static method. This method allows you to remove filters with a callback to a class
* you don't have access to.
*
* Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
"production" : {
"key" : "./ssh/id_rsa",
"user" : "node",
"host" : "212.83.163.1",
"ref" : "origin/master",
"repo" : "[email protected]:repo.git",
"path" : "/var/www/production",
"post-deploy" : "pm2 startOrRestart ecosystem.json --env production"
},