Skip to content

Instantly share code, notes, and snippets.

View heesienooi's full-sized avatar

Heesien Ooi heesienooi

View GitHub Profile
@heesienooi
heesienooi / aws_deployment_script.sh
Created June 27, 2018 12:49
aws elasticbeanstalk deployment script
#!/usr/bin/env bash
# Environment variables
# EB_ENV="website-qa"
# S3_BUCKET="qa-selfmade-assets"
# CLOUDFRONT_ID="E1B4KQ9M175W9L"
if [ -z "$EB_ENV" ] || [ -z "$S3_BUCKET" ] || [ -z "$CLOUDFRONT_ID"];
then
echo ""
@heesienooi
heesienooi / index.html
Created April 10, 2018 14:21
Standard index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<link rel="stylesheet" href="https://fonts.googleapis.com/fonts">
@heesienooi
heesienooi / flow-autologging-script.js
Created February 8, 2018 13:41
Butterfly Flow autologing script
async function logTime(url, hour, min, date, desc) {
console.group('Log', Array.prototype.slice.call(arguments).join(','));
const logTimeAPI = url + 'log-time?action=add&log_id=';
const formId = await $.get(logTimeAPI).then(res => {
const html = $('<div/>').html(res);
return html.find('#form_id').val();;
});
console.log('Submitting time...');
@heesienooi
heesienooi / mysql-docker.sh
Created May 13, 2017 03:36 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@heesienooi
heesienooi / docker-cleanup-resources.md
Created May 13, 2017 03:36 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@heesienooi
heesienooi / osx_setup.md
Created November 4, 2015 12:32 — forked from mcls/osx_setup.md
Setup mac for ruby dev
@heesienooi
heesienooi / pagination.php
Created September 23, 2014 05:18
Joomla pagination override - Reduce number of displayed pages
<?php
/**
* By default joomla display 10 pages in pagination. This file allows
* us to customize the number of displayed pages.
*
* Simply add this file to $template/html/pagination.php and
* change $displayedPages variable.
*/
defined('_JEXEC') or die('Restricted access');
@heesienooi
heesienooi / .gitignore
Created September 3, 2012 23:37
Butterfly standard gitignore
# Joomla files
/.htaccess
/configuration.php
/tmp
/cache
/administrator/cache
docman.config.php
dmdocuments/
@heesienooi
heesienooi / dynamicmenucal
Created April 16, 2012 00:16
JavaScript: Dynamic Menu Calculation
/* Author: Hee Sien Ooi < heesien.ooi@butterfly.com.au >
* Calculate and set menu items width and background according to menu ul width
* Version: 1.0
* Known issue: Maybe backgroud position for each item is not accuate, please check and tell me.
* Notes: Must set menu width and image in css
* Requirement: jQuery 1.7.2 +
* Usage: 1. Make sure you have your ul width (ie. #nav ul { width:960px; })
2. jQuery('#navi li').dynamicMenuCal (); (add cufon ready if using cufon)
*/