Skip to content

Instantly share code, notes, and snippets.

⌨️
coding

Emanuele DelBono emadb

⌨️
coding
Block or report user

Report or block emadb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View fizzbuzz.cs
using System;
using System.Linq;
using System.Collections.Generic;
namespace CodicePlastico
{
public class FizzBuzz
{
private static readonly IDictionary<int, string> _cases = new Dictionary<int, string>
{
{3, "fizz"},
@emadb
emadb / fizz_buzz.exs
Last active Aug 8, 2019
FizzBuzz in Elixir using only functions: no numbers, no strings, no loops and no ifs!
View fizz_buzz.exs
defmodule Church do
def fizzbuzz do
(fn k -> fn f -> ((fn f -> (fn x -> f.(fn y -> x.(x).(y) end) end).(fn x -> f.(fn y -> x.(x).(y) end) end) end).(
fn f -> fn l -> fn x -> fn g ->
(fn b -> b end).((fn p -> p.(fn a -> fn b -> a end end) end).(l)).(x).(fn y -> g.(f.((fn l -> (fn p -> p.(fn a -> fn b -> b end end) end)
.((fn p -> p.(fn a -> fn b -> b end end) end).(l)) end).(l)).(x).(g)).((fn l -> (fn p -> p.(fn a -> fn b -> a end end) end)
.((fn p -> p.(fn a -> fn b -> b end end) end).(l)) end).(l)).(y) end)
end end end end
)).(k).((fn x -> fn y -> fn f -> f.(x).(y) end end end).(fn x -> (fn y -> x end) end).(fn x -> (fn y -> y end) end))
@emadb
emadb / Dispatcher.js
Last active Oct 10, 2017
medium - react and redux
View Dispatcher.js
const dispatcher = {
subscribers: [],
register(subscriber) {
this.subscribers.push(subscriber)
},
dispatch(action) {
this.subscribers.forEach(s => s(action))
}
}
View gist:9d6adbeaeb8f924f9a07b86f7269929e
### Keybase proof
I hereby claim:
* I am emadb on github.
* I am emadb (https://keybase.io/emadb) on keybase.
* I have a public key whose fingerprint is 8F39 3A1D 85DC 83C7 B8C8 BDDE B295 AE38 057C 4B76
To claim this, I am signing this object:
@emadb
emadb / eslint.config.js
Last active Oct 28, 2016
My Eslint configuration
View eslint.config.js
{"rules": {
// https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb
/* best practices */
"accessor-pairs": 0,
// enforces return statements in callbacks of array's methods
// http://eslint.org/docs/rules/array-callback-return
"array-callback-return": 2,
// treat var statements as if they were block scoped
"block-scoped-var": 2,
// specify the maximum cyclomatic complexity allowed in a program
@emadb
emadb / SublimeText_shortcuts.md
Created May 20, 2016
Sublime Text Shorcuts
View SublimeText_shortcuts.md

##Text Editing

  • Insert line before - Cmd + Shift + Return
  • Insert line after - Cmd + Return
  • Delete the word backward - Option + Delete
  • Delete the word forward - fn + Option + Delete
  • Delete to beginning of the line - Cmd + Delete
  • Delete to end of the line - Ctrl + K
  • Delete word back - Option + Delete
  • Delete word forward - fn + Option + Delete
  • Soft undo - Cmd + U
View gist:8ef2832f83e6bd62cfa1
Verifying that +emanueledelbono is my blockchain ID. https://onename.com/emanueledelbono
@emadb
emadb / Sample.cs
Last active Aug 29, 2015
Run a set of tasks and wait for the first (in run order) that succeed
View Sample.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
@emadb
emadb / async kata
Last active Aug 29, 2015
Kata - synchronize asyncrounous results
View async kata
Consider to have a series of calculators functions that need to run in series.
These calculators are asynchronous and any of those can return a value (a number >=0) or an error (-1).
Calculators must be evaluated in order and you have to write a function that returns the value of the first calculator
that doesn't fail. For first I mean the first in the chain of calculators.
Test case
function calculator1(resultCallback){
setTimeout(function(){ resultCallback(-1) }, 1000);
}
You can’t perform that action at this time.