Skip to content

Instantly share code, notes, and snippets.

View prolic's full-sized avatar
💭
Writing Haskell

Sascha-Oliver Prolic prolic

💭
Writing Haskell
View GitHub Profile
# Make sure you grab the latest version
curl -OL https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip
# Unzip
unzip protoc-3.3.0-linux-x86_64.zip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@kchodorow
kchodorow / branch.sh
Created September 23, 2014 15:11
See all git branches with descriptions and last commit date
#!/bin/bash
# Shows branches with descriptions
branches=$(git for-each-ref --format='%(refname)' refs/heads/ | sed 's|refs/heads/||')
for branch in $branches; do
last_used=$(git show --pretty=format:"%Cgreen%cr%Creset" $branch | head -1)
desc=$(git config branch.$branch.description)
if [ $branch == $(git rev-parse --abbrev-ref HEAD) ]; then
branch="*\t$last_used\t\033[0;32m$branch\033[0m"
else
@olekhy
olekhy / gist:e0735a82449436db5c8e
Created September 16, 2014 12:57
perfomance testing for generation unique id from string smaller than 1000 chars
I've take an simple test for get sure what is the best basic case for this
Firstly my timing result:
```shell
% (php /tmp/testmd5.php); (php /tmp/testsha1.php); (php /tmp/teststr_replace.php); (php /tmp/teststrtr.php);
11.715120792389( php /tmp/testmd5.php; ) 11,73s user 0,01s system 99% cpu 11,750 total
13.626849889755( php /tmp/testsha1.php; ) 13,65s user 0,00s system 99% cpu 13,653 total
16.591732978821( php /tmp/teststr_replace.php; ) 16,60s user 0,02s system 99% cpu 16,627 total
87.248502969742( php /tmp/teststrtr.php; ) 87,24s user 0,01s system 99% cpu 1:27,28 total
@codeliner
codeliner / bc_interaction_sample.php
Created April 15, 2014 13:06
Sample to show interaction between two bounded contexts
<?php
/**
* This file is an example gist to show the interaction between an ArticleContext and a LikeContext
*
* @example:
*
* We have to bounded contexts: ArticleContext and LikeContext and show the simplified process of following use case:
*
* In order to create a valid article Like, I should validate the article ID given to the LikeContext.
*
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 18, 2024 16:07
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@krakjoe
krakjoe / pthreads.md
Last active August 30, 2023 18:30
pthreads.md

Multi-Threading in PHP with pthreads

A Brief Introduction to Multi-Threading in PHP

  • Foreword
  • Execution
  • Sharing
  • Synchronization
  • Pitfalls
@maartenba
maartenba / cakeunit4phpstorm.php
Last active October 9, 2020 18:16
CakePHP2 PHPUnit Runner for PHPStorm
<?php
// Clean argument values
$phpStormRunner = null;
$cleanedArgv = array();
foreach ($_SERVER['argv'] as $key => $value) {
if (strpos($value, 'ide-phpunit.php') === false) {
$cleanedArgv[] = $value;
} else {
$phpStormRunner = $value;
}
#!/bin/bash
OPTIONS="--retries=3 --userpass=username.1:x"
while :
do
./minerd $OPTIONS --url=http://ejpool.info:9332/
./minerd $OPTIONS --url=http://lc.ozco.in:9332/
./minerd $OPTIONS --url=http://litecoinpool.org:9332/
./minerd $OPTIONS --url=http://mine.pool-x.eu:8337/
done
@ezzatron
ezzatron / num-cpus.php
Created October 28, 2011 03:53
Function to detect number of CPUs in PHP
<?php
/**
* Copyright © 2011 Erin Millard
*/
/**
* Returns the number of available CPU cores
*
* Should work for Linux, Windows, Mac & BSD