Skip to content

Instantly share code, notes, and snippets.

View tamagokun's full-sized avatar

Mike Kruk tamagokun

View GitHub Profile
@tamagokun
tamagokun / foo.js
Created December 5, 2014 20:46
React - Backbone - Loading state
MyComponent = React.createClass({
componentDidMount: function(){
this.props.collection.on('request', function(){
this.setState({loading: true});
}.bind(this));
this.props.collection.on('sync', function(){
this.setState({loading: false});
}.bind(this));
@tamagokun
tamagokun / echoHttpRequest.js
Last active August 29, 2015 14:08 — forked from Marak/echoHttpRequest.js
Echo HTTP requests
module['exports'] = function echoHttp (hook) {
hook.debug("Debug messages are sent to the debug console");
hook.debug(hook.params);
hook.debug(hook.req.path);
hook.debug(hook.req.method);

Keybase proof

I hereby claim:

  • I am tamagokun on github.
  • I am mikey (https://keybase.io/mikey) on keybase.
  • I have a public key whose fingerprint is 611A B66E 0D87 039E 1B7A 86AC 7769 5EB6 703D A95C

To claim this, I am signing this object:

@tamagokun
tamagokun / bbf-sortable-list.js
Last active August 29, 2015 14:03
bbf-sortable-list.js
Form.editors.SortableList = Form.editors.List.extend({
initialize: function() {
Form.editors.List.prototype.initialize.apply(this, arguments);
},
render: function() {
Form.editors.List.prototype.render.apply(this, arguments);
// sorting
if (!this.sortable) {
@tamagokun
tamagokun / lircd.conf
Created April 16, 2014 10:43
LIRC Profile for Apple remote
begin remote
name Apple_A1156
bits 8
flags SPACE_ENC
eps 30
aeps 100
header 9065 4484
one 574 1668
zero 574 547
@tamagokun
tamagokun / gist:6985261
Last active December 25, 2015 13:39
Amazon EC2 web setup for Ubuntu.
#!/bin/sh
sudo apt-get install php5-common php5-mysql php5-xmlrpc php5-cgi php5-curl php5-gd php5-json php5-cli php5-fpm php-apc php-pear php5-dev php5-imap php5-mcrypt mysql-server nginx-full git subversion
sudo mkdir -p /etc/nginx/conf.d
sudo echo 'client_max_body_size 100m;' > /etc/nginx/conf.d/uploads.conf
sudo echo '# Upstream to abstract back-end connection(s) for PHP
upstream php {
server unix:/var/run/php5-fpm.sock;
}' > /etc/nginx/conf.d/php.conf
@tamagokun
tamagokun / config.php
Created June 12, 2013 15:38
Rack'em app for serving Wordpress applications via php-cgi. No longer needing to configure nginx/apache locally ftw.
<?php
require 'vendor/autoload.php';
class Cgi
{
public $app, $public_folder;
public function __construct($app, $public_folder)
{
@tamagokun
tamagokun / info.md
Created April 15, 2013 16:49
Misc Xserve information.

This would be the view looking at the end of the 12-pin cable that plugs into the backplane, with the other end plugged into the logic board, with the clip on the top: |clip|

+12V +12V +5V +3.3V +3.3V ?
GND GND GND GND GND ?

The "?" are probably data signals.

@tamagokun
tamagokun / widget.js
Created January 23, 2013 01:55
Updated twitter parsing
function load_tweets(account)
{
$.getJSON('http://search.twitter.com/search.json?lang=en&rpp=3&q=from:'+account+'&callback=?', function(data) {
data = data.results;
if(data.length)
{
$("#sw-twitter .sw-tweets").empty();
$.each(data,function(i,tweet) {
var date = tweet.created_at? $.timeago(new Date(tweet.created_at.replace(/^\w+ (\w+) (\d+) ([\d:]+) \+0000 (\d+)$/, "$1 $2 $4 $3 UTC"))) : '';
$("#sw-twitter .sw-tweets").append('<li><span class="date">'+date+'</abbr></span>'+linkify(tweet.text)+'</li>');
@tamagokun
tamagokun / global_composer.sh
Last active October 13, 2015 19:08
Setup composer for a global package manager
mkdir -p $HOME/.composer
echo '{
"minimum-stability": "dev",
"config": {
"vendor-dir": "vendor",
"bin-dir": "bin"
},
"require": {
}
}' > $HOME/.composer/composer.json