Skip to content

Instantly share code, notes, and snippets.

Trustify Android App

Code Smell :

[master] : There are several major issues with this branch :

@toopay
toopay / entity.erl
Created April 1, 2015 18:02
Riak injector
%% @doc Prepare map data
prepare_map(MapData) ->
%% The initial map to be expanded
InitialMap = riakc_map:new(),
%% Build tuple elem
Definition = element(2,MapData),
Data = [element(Nth, MapData) || Nth <- lists:seq(3,tuple_size(MapData))],
%% Fill in the data based by definition
@toopay
toopay / worker.erl
Created January 2, 2015 07:43
Useless worker
-module(worker).
-export([do_the_useless_job/0]).
do_the_useless_job() ->
TimeStart = unixtime(),
G = fun(X) -> timer:sleep(100), io:format("~p~n", [X]) end,
[spawn(fun() -> G(X) end) || X <- lists:seq(1,10)],
io:format("All done in ~p microseconds~n", [unixtime()-TimeStart]).
unixtime() ->
@toopay
toopay / brewfactory.erl
Created January 2, 2015 07:01
Pint in concurrent
-module(brewfactory).
-export([pint/0]).
pint() ->
receive
{Pid, heinekken} ->
Pid ! "Dankjewel!",
pint();
{Pid, guiness} ->
Pid ! "Thank you!",
@toopay
toopay / innocent.erl
Last active August 29, 2015 14:12
"Hello world!" [1]
-module(innocent).
-export([hi/0]).
hi() -> io:format("Hello world!").
%% Analog with bellow :
%% hi() -> io:format(["H","e","l","l","o"," ","w","o","r","l","d","!"]).
@toopay
toopay / innocent.erl
Created December 27, 2014 17:44
"Hello world!"
%% HOWTO : Compile and run `innocent:hi()`
%% @see http://codegolf.stackexchange.com/questions/22533/weirdest-obfuscated-hello-world?newreg=44a2bf18dcc44f7dbdddc27caf1b4ceb
-module(innocent).
-export([hi/0]).
hi() -> erlang:apply(
list_to_atom(
[A || A <- [ Mua + Ha + Haa || <<Mua:8, Ha:8, Haa:8>> <= <<105:24>> ]]
++ [A || A <- [ Mua + Ha + Haa || <<Mua:8, Ha:8, Haa:8>> <= <<111:24>> ]]),
list_to_atom(
@toopay
toopay / release.sh
Created March 23, 2014 18:48
Git SemVer release savant
#!/bin/bash
# Git Tag SemVer helpers
# Usage : !release <repo> <strategy>
# !release some_repo patch|minor|major
# Get arguments of repository and release strategy...
REPO=$1
if [ "" == "$2" ]
then
@toopay
toopay / install_intl.sh
Last active August 3, 2021 17:54
MAMP Intl
#!/bin/bash
# Install m4
cd /Applications/MAMP/bin/php/php5.4.10/include
wget ftp://ftp.gnu.org/gnu/m4/m4-1.4.10.tar.gz
tar -xvzf m4-1.4.10.tar.gz
cd m4-1.4.10
./configure --prefix=/usr/local/m4
make
sudo make install
@toopay
toopay / organisasi.md
Last active January 1, 2016 17:29
Tentang Group, LSM dan Asosiasi (Developer) : Apa yang kita perlukan? [Pandangan tentang rencana pelembagaan PHP Indonesia]

TL;DR;

Yang kita perlukan, sebagai developer bukanlah birokrasi melainkan komunitas (yang organik).

Dengan kata lain, values yang kita junjung mestilah :

  • Meetup, Drink-Up (ngopi atau nge-bir bareng), IRC dan Forum yang aktif, lebih baik daripada Rapat
  • Organizer, lebih baik daripada Presiden Atau CEO
  • Co-working space, lebih baik daripada inkubasi

Sebagai konsekuensi-nya, legalitas badan hukum ataupun bentuk formal lain, diperlukan (dan hanya diperlukan) sejauh dia mendukung tumbuhnya kegiatan komunitas yang organik.

@toopay
toopay / acl.php
Created December 9, 2013 03:59
Rule Access Example
return array(
'task_list' => array(
'user' => array(
'create' => 0x00, // 0000
'send_message' => 0x01, // 0001
'edit_profile' => 0x82, // 10000010
'edit_interest_cities' => 0x02, // 0010
'edit_interest_event_cat' => 0x02, // 0010
'edit_interest_comm_cat' => 0x02, // 0010
'edit_photo' => 0x02, // 0010