Skip to content

Instantly share code, notes, and snippets.

View quangbahoa's full-sized avatar
🎯
Focusing

Le Duy Quang quangbahoa

🎯
Focusing
View GitHub Profile
# If you meet install errors, see abid-hussain's comment
sudo apt-get --force-yes install build-essential openssl libreadline6 libreadline6-dev curl git-core \
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \
libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison
&&
\curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled
module Jekyll
class ArchivePage
include Convertible
attr_accessor :site, :pager, :name, :ext, :basename, :dir, :data, :content, :output
# Initialize new ArchivePage
# +site+ is the Site
# +month+ is the month
# +posts+ is the list of posts for the month
module Jekyll
class ArchiveGenerator < Generator
safe true
def generate(site)
collate_by_month(site.posts).each do |month, posts|
page = ArchivePage.new(site, month, posts)
site.pages << page
end
end
<?php
/**
* Plugin Name: Add Blog and User ID on Network
* Plugin URI: http://wpengineer.com/2188/view-blog-id-in-wordpress-multisite/
* Description: View Blog and User ID in WordPress Multisite
* Version: 1.0.0
* Author: Frank Bültge
* Author URI: http://bueltge.de
* License: GPLv3
*/
<?php # -*- coding: utf-8 -*-
// function remove_accents()
/**
* Unaccent the input string string. An example string like `ÀØėÿᾜὨζὅБю`
* will be translated to `AOeyIOzoBY`. More complete than :
* strtr( (string)$str,
* "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ",
* "aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn" );
*
@quangbahoa
quangbahoa / google-scripts.js
Last active August 29, 2015 14:20 — forked from duttajit50/sendsms
Send Google SMS
function sendsms()
{
try
{
var label = GmailApp.getUserLabelByName('sendsms');
var threads = label.getThreads();
var now = new Date().getTime();
var cal=getCalendar();
for(i in threads)
@quangbahoa
quangbahoa / smsMail
Last active August 29, 2015 14:20 — forked from anonymous/smsMail
function smsMail()
{
try
{
var label = GmailApp.getUserLabelByName('smsMail');
var threads = label.getThreads();
var now = new Date().getTime();
var cal=getCalendar();
for(i in threads)
<?php
add_filter( 'woocommerce_checkout_fields' , 'woo_remove_billing_checkout_fields' );
/**
* Remove unwanted checkout fields
*
* @return $fields array
*/
function woo_remove_billing_checkout_fields( $fields ) {
@quangbahoa
quangbahoa / mywidget-basic.php
Last active August 29, 2015 14:27 — forked from pommiegranit/mywidget-basic.php
Playing with WordPress widgets
<?php
/*
Plugin Name: My Widget
Plugin URI: http://mydomain.com
Description: My first widget
Author: Me
Version: 1.0
Author URI: http://mydomain.com
*/
<!-- adding Contact Form 7 into Wordpress Template and removing <br> tags
add the following to the wordpress template -->
<?php echo do_shortcode('[contact-form-7 id="211" title="Spanish Contact Form"]') ; ?>
<!-- add the following into the wp-config.php -->
define ('WPCF7_AUTOP', false );
<!-- This will remove the <br> tags that get added automatically when you call Contact Form 7 from the template via shortcode-->