Skip to content

Instantly share code, notes, and snippets.

@mchung
mchung / sourcing.io.html
Created February 5, 2014 19:35
Preloading video trick
<div class="preview">
<div class="inner">
<img src="/assets/site/placeholder-4abfbbec6d239b5708837804f8149b32.png">
<video preload="auto">
<source src="https://di3zio5pem6rb.cloudfront.net/site/preview.mp4" type="video/mp4">
<source src="https://di3zio5pem6rb.cloudfront.net/site/preview.ogv" type="video/ogv">
<source src="https://di3zio5pem6rb.cloudfront.net/site/preview.webm" type="video/webm">
</video>
</div>
@mchung
mchung / gist:7310077
Last active December 27, 2015 10:19
Building storm-0.9.0-rc2 on Mac OS X w/ Oracle-jdk1.7.0_07 11/04

Instructions for building storm locally

I'm running netty, so jzmq + 0mq are not guaranteed to work.

Install zeromq-3.2.4 with homebrew

brew install zeromq

Install nathanmarz-jzmq

@mchung
mchung / gist:5847244
Created June 24, 2013 01:36
remote debugging java processes
Let’s assume you’ve got an executable JAR file which launches a server listening on port 4444.
server:~ mchung$ java -jar server.jar
or
server:~ mchung$ java -classpath server.jar com.mchung.Server
Launching a Java process with debugging activated is easy when you pass in the correct arguments:
-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
For example:
@mchung
mchung / gist:5021788
Created February 23, 2013 23:16
sqlite database.yml
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
@mchung
mchung / Ping.js
Last active December 12, 2015 09:39
A funny little hack I put together over the weekend. Read this for more information: http://ping.marcchung.com
/**
* Each record captured by the form is represented as a PingAlert.
*/
function PingAlert(rowId, record) {
this.rowNum = rowId + 1;
// See Spreadsheet for information on index.
this.url = record[1];
this.email = record[2];
// Extra columns
@mchung
mchung / gist:4711177
Created February 5, 2013 00:49
FasterCSV around Tempfile.
def new_csv_file
file = Tempfile.new('data.csv')
FasterCSV.open(file.path, "w") do |csv|
csv << [1,2,3,4]
end
file
end
@mchung
mchung / wp_options.php
Created January 23, 2013 03:07
recreating wordpress wp_options
<?php
// from db
echo "from db\n";
$db_value = 'a:1:{i:0;s:19:"heroku-sendgrid.php";}';
echo $db_value;
echo "\n";
var_dump(unserialize($db_value));
echo "\n";
This file has been truncated, but you can view the full file.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by MySQL Server configure 5.1.58, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ ./configure --without-docs --without-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/mysql51/5.1.58 --localstatedir=/usr/local/var/mysql --sysconfdir=/usr/local/etc --with-plugins=innobase,myisam --with-extra-charsets=complex --with-ssl --without-readline --enable-assembler --enable-thread-safe-client --enable-local-infile --enable-shared --with-partition
## --------- ##
## Platform. ##
@mchung
mchung / slicehost-api.rb
Created June 16, 2012 04:02
Slicehost API
require 'rubygems'
require 'activeresource'
SITE = "https://<key goes here>@api.slicehost.com/"
class Slice < ActiveResource::Base
self.site = SITE
def self.find_by_name(name)
Slice.find(:first, :params => { :name => name })
end
<!doctype html>
<html ng-app="MyApp">
<script src="http://code.angularjs.org/angular-1.0.0rc7.js"></script>
<script type="text/javascript">
var app = angular.module('MyApp', []);
app.factory('greeter', function($window) {
return {
greet: function(text) {
$window.alert(text);
}