Skip to content

Instantly share code, notes, and snippets.

View gtkatakura's full-sized avatar

gtkatakura

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
// Version C# to: https://gist.github.com/adomokos/989193
function identity(value) {
return value;
}
function createArray(length, transformation) {
transformation = transformation || identity;
var arr = [];
while (length != 0) {
arr.push(transformation(arr.length));
const hackerPowers = {
hackFacebook(userName) {
// something code
return `Olá, Mr ${userName}, meu nome é ${this.name}... e eu fodi a sua timeline ;)`;
},
};
const composeWithDelegation = (obj, delegator) => {
for (let [key, value] of Object.entries(delegator)) {
if (typeof value === 'function') {
@gtkatakura
gtkatakura / introrx.md
Created July 5, 2016 00:49 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
const atomicArray = require('atomic-array') // [Function]
const randomNumber = require('random-number') // [Function]
const arr1 = atomicArray(10, randomNumber)
const arr2 = atomicArray(10, randomNumber.createEven)
const arr3 = atomicArray(10, randomNumber.createOdd)
const Estudo = Class.new do
public static void main(...args: string[]) {
Func<int, int, Number> somar = (x, y) => +$this->soma(new Integer(x), new Integer(y));
local left, right = args.map(Integer::parseInt);
puts resultado.call(left, right)
}
soma :: Integer -> Integer -> Integer
def soma(n1, n2):
EndNo = Class.new {
define_method(:if_example) { |condition|
(condition && ->{
"yeah, true!"
} || ->{
"why not?"
}).call
}
define_method(:while_example) { |limit|
console.log('Conta');
class Conta {
constructor() {
this.saldo = 0;
}
deposita(valor) {
this.saldo += valor;
}
}
const isObject = value => typeof value === 'object' && value !== null;
const mergeDeepWithoutLoop = (target, source) => {
source = new Proxy(source, {
get: function(source, property) {
const value = source[property];
if (isObject(value)) {
return mergeDeepWithoutLoop(target[property], value);
}
// library or otherwise
// {
type Func<T, TResult> = (value: T) => TResult;
type Predicate<T> = Func<T, boolean>;
function compose<TIn, TMiddle, TOut>(f: Func<TMiddle, TOut>, g: Func<TIn, TMiddle>) {
return (value: TIn) => f(g(value));
}