Skip to content

Instantly share code, notes, and snippets.

@korya
korya / gist:7368277
Last active December 27, 2015 18:18
Notes for HTML5 Game Development by Udacity

XMLHttpRequest

  1. Create a new request
  2. Prepare the request
  3. Set the onload callback. The callback can access the response by referencing this.responseText.
  4. Send the request
  var xhr = new XMLHttpRequest();
@korya
korya / Subfolder to git repo.md
Last active December 16, 2023 10:29
Convert subfolder into Git submodule
@korya
korya / gist:10341712
Last active June 2, 2016 12:55
Shortcut for terminal in MacOS

The approach is based on this answer:

  1. Create a new service in Automator
  2. The service just executes a custom applescript openning a new terminal window
  3. Assign a shortcut to the service

This solution is great, since it does not require to install a third party application for such trivial task. The only problem with it is the applescript provided in the answer uses activate, which steals a focus from current window, which in its turn can lead to switching to a different virtual desktop.

@korya
korya / README.md
Created June 26, 2014 14:18
Quick Node.js webserver for serving static content

Many times I need just to run a simple webserver in a specific directory. That is the solution I came up with.

Installation

Put the files somewhere and then:

$ npm install

Usage

@korya
korya / Docker-tricks.md
Last active August 29, 2015 14:04
Docker tricks

Exploring container's FS

First get a name or an ID of your docker container:

DOCKERID=$(docker ps | awk ...)

Quick and dirty

@korya
korya / gist:fcbea22b4f96ce9b14a2
Last active August 29, 2015 14:04
Convert git repo subhistory to a separate git repo
  1. Clone

    git clone <remote-url> <dir>
    cd <dir>
    git remote rm origin
  2. Find a start commit of your history

START=git log | grep ...

@korya
korya / func-inv.go
Last active August 29, 2015 14:05
Golang's invariance
/* "Invariance" in golang
* http://play.golang.org/p/ww9UEEKI97
*
* Output:
* > B::foo
* > C::foo
* > B::foo
* > B::bar
* > B::bar
*/
@korya
korya / main.go
Last active August 29, 2015 14:06
goamz + fakes3 example
package main
import (
"fmt"
"github.com/crowdmob/goamz/aws"
"github.com/crowdmob/goamz/s3"
)
var (