Skip to content

Instantly share code, notes, and snippets.

View lguzzon's full-sized avatar
Quality Is Free - Getting There Isn't

Luca Guzzon lguzzon

Quality Is Free - Getting There Isn't
View GitHub Profile
@lguzzon
lguzzon / parsers.nim
Created September 1, 2017 12:01 — forked from kmizu/parsers.nim
parser combinator library in Nim
import strutils
import lists
import re
type
Parser[T] = proc(input: string): Maybe[(T, string)]
Maybe*[T] = object
value: T
hasValue: bool
import httpclient, asyncdispatch, strutils, tables, unicode, json, math, times
const
ForecastUrlFormat = "http://api.openweathermap.org/data/2.5/forecast/daily?APPID=$1&lang=en&q=$2&cnt=$3"
ResultFormat = """$1:
$2
Temperature: $3 °C
Humidity: $4%
Clouds: $5%
@lguzzon
lguzzon / Main.hx
Created June 6, 2017 07:41 — forked from jcward/Main.hx
Haxe String.split() is 100x slower in macro context than runtime?!
class Main
{
public static var text:String;
public static function main()
{
var text = "";
in_macro();
/**
* This Google Sheets script keeps data in the specified column sorted any time
* the data changes.
*
* After much research, there wasn't an easy way to automatically keep a column
* sorted in Google Sheets, and creating a second sheet to act as a "view" to
* my primary one in order to achieve that was not an option. Instead, I
* created a script that watches for when a cell is edited and triggers
* an auto sort.
*

Keybase proof

I hereby claim:

  • I am lguzzon on github.
  • I am lguzzon (https://keybase.io/lguzzon) on keybase.
  • I have a public key whose fingerprint is 6004 C5E6 E27B B4F2 E9AF 192E 673E 2940 C03B 7416

To claim this, I am signing this object:

import Map;
class OrderedMapIterator<K,V> {
var map : OrderedMap<K,V>;
var index : Int = 0;
public function new(omap:OrderedMap<K,V>)
map = omap;
public function hasNext() : Bool
@lguzzon
lguzzon / captureAjaxResponses.js
Last active December 20, 2015 16:39 — forked from markstreich/gist:3667944
PhantomJS script that is working for me ... the up-stream no
var page = require('webpage').create();
page.onInitialized = function () {
captureAjaxResponsesToConsole();
};
page.open('http://www.website.com/', function (status) {
if (status === 'success') {
phantom.exit();
} else {
@lguzzon
lguzzon / android.sh
Created May 7, 2013 14:10
Modified Android tool working with system proxy in Ubuntu ... introduced $proxy_opts shell variable http://developer.android.com/tools/help/android.html
#!/bin/sh
# Copyright 2005-2007, The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software