Skip to content

Instantly share code, notes, and snippets.

@mikechau
mikechau / application.scss
Created May 2, 2013 16:31
Dashing Highcharts Pie
/*
//=require_directory .
//=require_tree ../../widgets
*/
// ----------------------------------------------------------------------------
// Sass declarations
// ----------------------------------------------------------------------------
$background-color: #222;
$text-color: #fff;
@mikechau
mikechau / database.yml
Created May 3, 2013 16:41
Having Active Record Interface with 2 Databases
#In rails this is located in the config folder
# if you have the db defined in database.yml, you can set the establish_connection to establish_connection("db2")
development:
adapter: mysql2
database: indicator_development
pool: 5
username: root
password: root
socket: /var/run/mysqld/mysqld.sock
@mikechau
mikechau / countdown.coffee
Created May 3, 2013 21:26
Dashing Countdown Customized for Stock Market
#a bunch of dirty hacks right now to the original countdown widget
#original: https://gist.github.com/ruleb/5353056
class Dashing.Countdown extends Dashing.Widget
ready: ->
setInterval(@startCountdown, 500)
startCountdown: =>
count_to_close = true
@mikechau
mikechau / Main.sublime-menu
Created May 10, 2013 19:03
Sublime View: (1 column) | (1 column + 2 row)
[{
"id": "view",
"children": [{
"id": "layout",
"children": [{
"caption" : "Custom 1",
"command": "set_layout",
"args":
{
"cols": [0.0, 0.5, 1.0],
@mikechau
mikechau / tasks_spike.rb
Created May 16, 2013 13:22
Tasks Scheduler (Refactor)
require 'rufus/scheduler'
require 'json'
require 'httparty'
require 'rake'
##################################################################
### INITIALIZERS
##################################################################
@start_day = Date.today.beginning_of_day
@finish_day = Date.today.end_of_day
@mikechau
mikechau / chart_example.js
Last active December 17, 2015 13:59
JSON Parsing
$(function () {
$('#container').highcharts({
chart: {
type: 'bar'
},
title: {
text: 'Leading Indicators'
},
subtitle: {
text: 'Source: Rbandits::Trdopt'
@mikechau
mikechau / gist:5743033
Created June 9, 2013 10:10
Amazon EC2 + Sinatra Application Deployment
## connecting
sudo chmod 0600 ~/Downloads/sandbox.pem
ssh -i ~/Downloads/sandbox.pem ubuntu@ec2-23-22-18-249.compute-1.amazonaws.com
## create users
sudo adduser mike
## add user to admin
sudo adduser mike admin
@mikechau
mikechau / ajax.js
Last active April 6, 2023 10:53
Bootstrap Modal, ajax submit, and close on submit
$(function(){
$('#myFormSubmit').click(function(e){
e.preventDefault();
alert($('#myField').val());
$('#myModal').modal('hide')
/*
$.post('http://path/to/post',
$('#myForm').serialize(),
function(data, status, xhr){
// do something here with response;
@mikechau
mikechau / grunt.js
Last active December 20, 2015 17:28
grunt tasks
// Default task.
grunt.registerTask('default', 'lint');
grunt.registerTask('lint', ['jshint', 'csscss']);
// jenkins should run this
grunt.registerTask('build', 'jshint clean copy requirejs cssmin');
grunt.loadNpmTasks('grunt-contrib');
grunt.loadNpmTasks('grunt-contrib-jshint');
@mikechau
mikechau / xinput
Created September 14, 2013 19:21
input settings
xinput --set-ptr-feedback "15" 0 30 10
tpkbdctl -s 255