Skip to content

Instantly share code, notes, and snippets.

View Narga's full-sized avatar

Nguyễn Đình Quân Narga

View GitHub Profile
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@Narga
Narga / deploy
Created June 6, 2014 18:51 — forked from sbuzonas/deploy
#!/usr/bin/env bash
GIT_DIR_SAVE=$GIT_DIR ; unset GIT_DIR
GIT_WORK_TREE_SAVE=$GIT_WORK_TREE ; unset GIT_WORK_TREE
if [ ! -f "${OPENSHIFT_DATA_DIR}composer/bin/composer" ]; then
export COMPOSER_HOME="${OPENSHIFT_DATA_DIR}.composer"
echo $COMPOSER_HOME > ${OPENSHIFT_HOMEDIR}.env/user_vars/COMPOSER_HOME
echo "Installing composer"
curl -s https://getcomposer.org/installer | env - PATH="/usr/bin:$PATH" php -- --install-dir=$OPENSHIFT_DATA_DIR >/dev/null
@Narga
Narga / master.vim
Created February 13, 2014 15:30 — forked from gmccreight/master.vim
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@Narga
Narga / 0_reuse_code.js
Created February 10, 2014 08:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Narga
Narga / Git Command Tricks
Created February 7, 2014 16:33
Git Command Tricks
/* Git Command Tricks
(C) 2003 Dinh Quan Nguyen a.k.a Narga <dinhquan (at) narga (dot) net>
* Website: http://www.narga.net
* http://www.narga.org
*
* You are allowed to use this software in any way you want providing:
* 1. You must retain this copyright notice at all time
* 2. You must not claim that you or any other third party is the author of this software in any way.
* 3. Feedback to me (dinhquan@narga.net) when you use my works, I will add you to customer list!
* 4. The CSS, XHTML, JS and design is released under GPL: http://www.opensource.org/licenses/gpl-license.php
@Narga
Narga / tlp
Created February 5, 2014 16:53 — forked from w0ng/tlp
# ------------------------------------------------------------------------------
# tlp - Parameters for power save
# Hint: some features are disabled by default, remove the leading # to enable them
# Set to 0 to disable/1 to enable TLP
TLP_ENABLE=1
# Seconds laptop mode has to to wait after the disk goes idle before doing a sync.
# Non-zero value enables, zero disables laptop mode.

TL;DR skip to the summary for the bash one-liner if so inclined :-)

Why & wherefore

I have an old tumblr that I want to back up. I don't use it regularly, but I want to have a backup of the whole site, design as well as content, just in case; it's not just the pictures I love, but the whole thing. I'm not particularly worried about downloading the streaming audio--can't help you there, gentle reader.

@Narga
Narga / Equal Height Columns
Last active December 30, 2015 11:09
This method relies on JavaScript to set the height attribute of all the columns in the layout to the height of the tallest column. In this example, I have used jQuery to equalize the columns.
This method relies on JavaScript to set the height attribute of all the columns in the layout to the height of the tallest column. In this example, I have used jQuery to equalize the columns.
You can put the JavaScript in a separate file and attach it to your HTML or use it inline but make sure you also attach jquery to the HTML page and this script is called after jquery is attached.
The code you need to change is the css class of the div elements that make the columns. In this example it is:
.container > div
You may replace the above with the css class that describes all the <div> elements of the columns. For example: you may add a class to each of the three columns and use that instead for simplicity.
@Narga
Narga / index
Created September 20, 2013 06:47 — forked from joanhard/index
<div class="row">
<div class="large-8 column">
<div class="main">My Main</div>
</div>
<div class="large-4 column full-height">
<aside class="sidebar">
My Sidebar
</aside>
</div>
</div>

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