Skip to content

Instantly share code, notes, and snippets.

View hoandang's full-sized avatar
👟
Roaming

Hoàn Đặng hoandang

👟
Roaming
  • Sydney, Australia
View GitHub Profile
var
gulp = require('gulp'),
plumber = require('gulp-plumber'),
prefixer = require('gulp-autoprefixer'),
coffee = require('gulp-coffee'),
babel = require('gulp-babel'),
sass = require('gulp-sass'),
gutil = require('gulp-util'),
minify = require('gulp-minify-css'),
uglify = require('gulp-uglify'),
@hoandang
hoandang / media-queries.css
Created March 4, 2014 00:29
Most common media queries
@media (max-width: 1024px) { }
@media (max-width: 966px) { }
@media (max-width: 800px) { }
@media (max-width: 768px) { }
@media (max-width: 640px) { }
@media (max-width: 603px) { }
@media (max-width: 600px) { }
@media (max-width: 568px) { }
@media (max-width: 480px) { }
@media (max-width: 460px) { }
@hoandang
hoandang / MtGox.php
Created March 4, 2014 05:53
A small chuck of MTGox system
<?php
namespace Money;
class Bitcoin {
#const BITCOIN_NODE = '173.224.125.222'; // w001.mo.us temporary
const BITCOIN_NODE = '50.97.137.37';
static private $pending = array();
public static function update() {
@hoandang
hoandang / vhost.conf
Last active August 29, 2015 13:57
Virtual host on ubuntu
alias apache-restart="sudo /etc/init.d/apache2 restart"
alias apache-start="sudo /etc/init.d/apache2 start"
alias apache-stop="sudo /etc/init.d/apache2 stop"
# cp any template.conf from this dir (new site must have .conf extension)
alias vhost="cd /etc/apache2/sites-available"
# <VirtualHost *>
# ServerName foo.dev
# DocumentRoot /home/hoan/www/
# </VirtualHost>
@hoandang
hoandang / useful-commands.md
Last active August 29, 2015 13:57
Useful custom commands
Delete remote branch
git push origin :<remote-branch-name>
Git diff 2 branches
git diff --stat --color <branch1>..<branch2> 
or
git diff --name-status <branch1>..<branch2>

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@hoandang
hoandang / adhoc-provision.md
Last active August 29, 2015 14:02
Create an ad-hoc provisioning
  1. Create a signed request
  2. Register UDDI for testing devices
  3. Create a provision distribution in apple dev console
  4. REMEMBER TO CHECK PROVISIONING PROFILE before archiving the project
  5. If some of the errors below occur during archiving
  • the icon or launch image error: fix the size
  • wrong builde id: make sure it fit with the bundle in apple developer console

Add UITextFieldDelegate then assign delegate for every uitextfield in the view

// Detect user touches outside keyboard and dismiss the keyboard
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.view endEditing:YES];
}

[texfield addTarget:self action:@selector(dismissKeyboard:) forControlEvents:UIControlEventEditingDidEndOnExit];
/* actions fired when listing/adding/editing posts or pages */
/* admin_head-(hookname) */
add_action( 'admin_head-post.php', 'admin_head_post_editing' );
add_action( 'admin_head-post-new.php', 'admin_head_post_new' );
add_action( 'admin_head-edit.php', 'admin_head_post_listing' );
function admin_head_post_editing() {
echo 'you are editing a post';
}
@hoandang
hoandang / data.xml
Last active August 29, 2015 14:23
data
<?xml version="1.0" encoding="iso-8859-1"?>
<data>
<row>
<product>Line of Credit Fixed =&lt;$750k</product>
<bank>Macquarie Bank</bank>
<rate>4.690</rate>
<initial_rate_type>F</initial_rate_type>
<initial_rate>4.390</initial_rate>
<initial_rate_period>12</initial_rate_period>
<application_fees>0</application_fees>