Skip to content

Instantly share code, notes, and snippets.

View nickwanhere's full-sized avatar

Nick Wan nickwanhere

  • Hong Kong
View GitHub Profile
@nickwanhere
nickwanhere / jQuery: ready
Last active October 3, 2015 13:48
jQuery: ready
$(document).ready(function()
{
});
@nickwanhere
nickwanhere / Wordpress Add JS CSS
Last active October 11, 2015 09:28
Wordpress Add JS/CSS
function my_scripts_method() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
wp_enqueue_script( 'jquery' );
}
add_action('wp_enqueue_scripts', 'my_scripts_method');
@nickwanhere
nickwanhere / Wordpress Template Text
Last active October 11, 2015 09:37
Wordpress Template Text
/**
* Template Name: Showcase Template
* Description: A Page Template that showcases Sticky Posts, Asides, and Blog Posts
*
* The showcase template in Twenty Eleven consists of a featured posts section using sticky posts,
* another recent posts area (with the latest post shown in full and the rest as a list)
* and a left sidebar holding aside posts.
*
* We are creating two queries to fetch the proper posts and a custom widget for the sidebar.
*
@nickwanhere
nickwanhere / ieplaceholder
Last active December 19, 2015 23:58
ieplaceholder
jQuery(document).ready(function($) {
jQuery('input[placeholder]').each(function(){
var ph=jQuery(this).attr('placeholder');
if(jQuery(this).val()=='')
jQuery(this).val(ph);
jQuery(this).focus(function(){
@nickwanhere
nickwanhere / gist:b31f8c6ad4998c0e1a39
Created November 7, 2014 14:27
Magento Pepperjam Network Code
<?php
/*********Start Pepperjam Network Codes #1 ******/
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$order = Mage::getSingleton('sales/order');
$order->load($lastOrderId);
$_totalData = $order->getData();
$_currency = $_totalData['order_currency_code'];
$_productData = $order->getAllItems();
@nickwanhere
nickwanhere / README.md
Last active August 29, 2015 14:26 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
<?php
/**
* go to https://api.slack.com/web to create your access-token. The token will look somewhat like this:
* xoxo-2100000415-0000000000-0000000000-ab1ab1
*/
public static function slack($message, $channel) {
{
$ch = curl_init("https://slack.com/api/chat.postMessage");
$data = http_build_query([
sudo dpkg-reconfigure tzdata
function toUnicode(theString) {
var unicodeString = '';
for (var i=0; i < theString.length; i++) {
var theUnicode = theString.charCodeAt(i).toString(16).toUpperCase();
while (theUnicode.length < 4) {
theUnicode = '0' + theUnicode;
}
theUnicode = '\\u' + theUnicode;
unicodeString += theUnicode;
}
@nickwanhere
nickwanhere / gist:85bfbe8143ded6a30acb
Created October 27, 2015 08:29
Programmatically set magento locale
<?php
$locale = 'nl_NL';
Mage::app()->getLocale()->setLocaleCode($locale);
Mage::getSingleton('core/translate')->setLocale($locale)->init('frontend', true);
//http://www.kennydeckers.com/programatically-set-locale-language-magento/
?>