Skip to content

Instantly share code, notes, and snippets.

@tixel
tixel / Vagrantfile
Last active August 29, 2015 14:14 — forked from ErikEvenson/Vagrantfile
# This configuration will set up a database (db) and a web server (web) VM.
# Assumes the use of VirtualBox 4.3.14-95030 as a provider.
# Uses vagrant-vbguest plugin (https://github.com/dotless-de/vagrant-vbguest)
# to keep VirtualBox Guest Addition wrangled.
# Configuration
# Machine-specific configuration
DB_INSTALL_SCRIPT = "vagrant_data/db/install.sh"
@tixel
tixel / gist:7369260
Created November 8, 2013 10:37
docker cleanup commands
** delete all containers **
docker rm `docker ps -a -q`
**delete all images**
docker rmi `docker images -q`
@tixel
tixel / gist:4164768
Created November 28, 2012 21:39
install mysql for python on ubuntu 12.04
apt-get install python-pip
pip install -U pip
apt-get install python-dev libmysqlclient-dev
pip install MySQL-python
@tixel
tixel / gist:2510316
Created April 27, 2012 15:50
convert charsets
Charset utf8charset = Charset.forName("UTF-8"); Charset iso88591charset = Charset.forName("ISO-8859-1"); ByteBuffer inputBuffer = ByteBuffer.wrap(new Byte[]{(byte)0xC3, (byte)0xA2}); // decode UTF-8 CharBuffer data = utf8charset.decode(inputBuffer); // encode ISO-8559-1 ByteBuffer outputBuffer = iso88591charset.encode(data); byte[] outputData = outputBuffer.array();
@tixel
tixel / gist:2145891
Created March 21, 2012 09:59
prefix operator java
public class Tester {
/**
* @param args
*/
public static void main(String[] args) {
System.out.println("fout : "+fout());
System.out.println("juist : "+juist());
}
@tixel
tixel / array_shallow_copy
Created January 3, 2012 12:10
Cloning an array (shallow copy)
var exampleObject:Object = {name:"example", value:3};
var originalArray:Array = [1,"test", exampleObject];
var shallowCopy:Array = originalArray.concat(); // there is not built-in method, concat() or slice() with no args does
var shallowCopy2:Array = originalArray.slice(); // the trick
if (originalArray != shallowCopy != shallowCopy2)
trace("the 3 arrays are different");
@tixel
tixel / gist:1438435
Created December 6, 2011 14:47
bitmapdata-and-bytearray-from-embed-in-flex
/* found on: http://blog.somepixels.net/2010/01/how-to-get-bitmapdata-and-bytearray-from-embed-in-flex/ */
[Embed(source="image.png")]
public var MyEmbed:Class;
private function getBitmapData():BitmapData
{
var bitmapAsset:BitmapAsset = new MyEmbed();
return bitmapAsset.bitmapData;
}
@tixel
tixel / ExtractsListBaseFlex4.as
Created November 9, 2011 20:08
Some short extracts from the Flex 4 ListBase class to demonstrate the usage UIDs in the framework
// package mx.controls.listClasses
// class ListBase
/**
* The UID of the item that is current rolled over or under the caret.
*/
protected var highlightUID:String;
/**