Skip to content

Instantly share code, notes, and snippets.

@cooldaemon
cooldaemon / udp_server.erl
Created July 23, 2008 01:53
This is udp server framework for Erlang.
%% @author Masahito Ikuta <cooldaemon@gmail.com> [http://d.hatena.ne.jp/cooldaemon/]
%% @copyright Masahito Ikuta 2008
%% @doc UDP Server Behaviour.
%% Copyright 2008 Masahito Ikuta
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
@ftao
ftao / install_pytho27.sh
Created July 7, 2011 10:00
install python 2.7 on debian 6
#!/bin/sh
mkdir ~/down/
cd ~/down/
sudo apt-get install build-essential
wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
tar -xzf Python-2.7.2.tgz
cd Python-2.7.2
sudo apt-get install libsqlite3-dev zlib1g-dev libncurses5-dev
sudo apt-get install libgdbm-dev libbz2-dev libreadline5-dev
sudo apt-get install libssl-dev libdb-dev
@JakeWharton
JakeWharton / AndroidManifest.xml
Created August 5, 2011 03:05
How to use ActionBarSherlock tab style on native TabWidget.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.actionbarsherlock.sample.stylenativetabs"
android:versionCode="1"
android:versionName="1.0.0">
<uses-sdk android:minSdkVersion="4" />
<application android:label="Styled Native Tabs" android:theme="@style/Theme.Sherlock">
@drewjoh
drewjoh / custom.js
Created January 27, 2012 13:55
Dynamic (AJAX) loaded Bootstrap Modal (Bootstrap 2.1)
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
e.preventDefault();
var url = $(this).attr('href');
if (url.indexOf('#') == 0) {
$(url).modal('open');
} else {
@cooldaemon
cooldaemon / process_vs_ets_vs_mnesia.erl
Created March 31, 2012 16:28
Process vs ETS vs Mnesia
-module(process_vs_ets_vs_mnesia).
-author('cooldaemon@gmail.com').
-export([run/3]).
-record(store, {key, value}).
run(TryCount, ProcessCount, ReadCount) ->
Pids = lists:map(
fun (_) -> spawn_link(fun reader_process/0) end,
@rambocoder
rambocoder / boss_rebar.erl
Created April 4, 2012 18:46
Windows Support. Updated start-server.bat for ChicaboBoss skeleton, and ChicagoBoss\priv\rebar\boss_rebar.erl with windows support
%%%-------------------------------------------------------------------
%%% @author Jose Luis Gordo Romero <jgordor@gmail.com>
%%% @doc Chicago Boss rebar functions, called from boss_plugin
%%% Managing compilation/configuration/scripts stuff, the boss way
%%% @end
%%%-------------------------------------------------------------------
-module(boss_rebar).
-export([run/4,
help/0,
@egobrain
egobrain / file_upload_example.html
Created April 6, 2012 05:44
File upload example that uses new Browser HTML5 Upload API.
<style>
#dropZone {
color: #555;
font-size: 18px;
text-align: center;
width: 400px;
padding: 50px 0;
margin: 50px auto;
@lukaslundgren
lukaslundgren / python27_on_debian.sh
Created May 11, 2012 12:58
How to install python 2.7 on debian
sudo apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline5-dev libssl-dev libdb-dev
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar -xzf Python-2.7.3.tgz
cd Python-2.7.3
./configure --prefix=/usr --enable-shared
make
sudo make install
cd ..
@egobrain
egobrain / upload_handler.erl
Created May 25, 2012 13:17
upload_handler
-module(upload_handler).
-behaviour(cowboy_http_handler).
-export([init/3, handle/2, terminate/2]).
init({_Transport, http}, Req, []) ->
{ok, Req, {}}.
handle(Req, State) ->
{Method,Req2} = cowboy_http_req:method(Req),
case Method of
@egobrain
egobrain / cowboy_multipart_uploader.erl
Created May 30, 2012 06:47
Cowboy files uploader.
%%%-------------------------------------------------------------------
%%% @author egobrain <egobrain@linux-ympb>
%%% @copyright (C) 2012, egobrain
%%% @doc
%%% Function for uploading files and properties,which were sent as a
%%% multipart. Files are stored in tmp_folder with random name,
%%% generated by tmp_filename function.
%%% @end
%%% Created : 25 Mar 2012 by egobrain <egobrain@linux-ympb>
%%%-------------------------------------------------------------------