Skip to content

Instantly share code, notes, and snippets.

View pietro909's full-sized avatar

pietro909 pietro909

View GitHub Profile
@pietro909
pietro909 / config.json
Created March 4, 2022 14:36
Sample config for paginated and archived messages
{
"global": {
"autoLogin": true,
"allowRandomValues" : false
},
"profile": {
"attrs": {
"name": "Gian Maria"
}
},
@pietro909
pietro909 / en.json
Last active February 14, 2020 16:56
{
"Home": "Home",
"Matches": "Matches",
"Sign up": "Sign up",
"My Bets": "My Bets",
"Account": "Account",
"More": "More",
"Welcome back!": "Welcome back!",
"No results": "No results",
"We sent you a code": "We sent you a code",
@pietro909
pietro909 / elm-compile-benchmark.md
Last active March 29, 2019 14:14
Elm 0.18 vs 0.19 - compile time

Elm 0.18 with debug

$ time ./node_modules/.bin/elm-make src/Main.elm --output dist/index.js --debug Success! Compiled 219 modules. Successfully generated dist/index.js ./node_modules/.bin/elm-make src/Main.elm --output dist/index.js --debug 173.55s user 40.82s system 160% cpu 2:13.39 total

@pietro909
pietro909 / nested-navigator-example.js
Created June 18, 2017 17:38
React Native: nested Navigator example
import React from "react";
import {
NavigationActions,
StackNavigator,
TabNavigator,
} from "react-navigation";
/* ...import pages... */
export const Welcome =
@pietro909
pietro909 / index.html
Created April 13, 2017 09:37
JS Bin Convert JSON to valid Elm data structure (record) // source http://jsbin.com/duneqo
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Convert JSON to valid Elm data structure (record)">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/lodash/4/lodash.min.js"></script>
@font-face {
font-family: 'Futura-BT-normal';
src: url( 'http://www.magdaazab.it/assets/fonts/futura/futura_book_bt/FUTURAN.TTF' );
}
@font-face {
font-family: 'Futura-BT-bold';
src: url( 'http://www.magdaazab.it/assets/fonts/futura/futura_heavy_bt/FUTURAH.TTF' );
}
@pietro909
pietro909 / flatten.js
Created February 7, 2017 10:49
A recursive flatten function for arbitrary nested arrays. Stack is the limit :-)
/**
* Flatten arbitrary nested arrays.
*
* @arg the array to flatten
* @return array with depth 1, empty array for non-arrays
*/
const flatten = (arrayOfArrays = []) => {
if (arrayOfArrays.length === 0) {
return []
}
import Html exposing (beginnerProgram, div, input, text)
import Html.Events exposing (onInput)
main =
beginnerProgram
{ model =
{ name = ""
}
, view = view
@pietro909
pietro909 / kata.scala
Last active January 3, 2017 19:55 — forked from anonymous/kata.scala
Functional Programming in Scala - Chapter 2
import com.scalakata._
@instrument class Playground {
// help
def isSorted[A](as: Array[A], ordered: (A, A) => Boolean): Boolean = {
def go(n: Int): Boolean =
if (n >= as.length-1) true
else if (!ordered(as(n), as(n+1))) false
else go(n+1)
@pietro909
pietro909 / runtime-error-elm.elm
Created October 28, 2016 08:37
Trying to reproduce runtime error conditions
import Html exposing (text, div)
import String
import List
contains c s =
-- we should use String.contains
(List.length (String.indexes c s)) > 0
main =
div []