Skip to content

Instantly share code, notes, and snippets.

View proudlygeek's full-sized avatar
🍕

Gianluca Bargelli proudlygeek

🍕
View GitHub Profile
@proudlygeek
proudlygeek / nested.txt
Created January 19, 2022 09:30 — forked from alexey-milovidov/nested.txt
Example of Nested data type in ClickHouse.
:) CREATE TABLE test.nested (EventDate Date, UserID UInt64, Attrs Nested(Key String, Value String)) ENGINE = MergeTree(EventDate, UserID, 8192)
CREATE TABLE test.nested
(
EventDate Date,
UserID UInt64,
Attrs Nested(
Key String,
Value String)
) ENGINE = MergeTree(EventDate, UserID, 8192)
@proudlygeek
proudlygeek / golang-nuts.go
Created August 20, 2019 09:29 — forked from ryanfitz/golang-nuts.go
two ways to call a function every 2 seconds
package main
import (
"fmt"
"time"
)
// Suggestions from golang-nuts
// http://play.golang.org/p/Ctg3_AQisl
@proudlygeek
proudlygeek / hiring.js
Created January 24, 2019 16:52
Stuff for Konami Code
console.log('%c We\'re hiring dumbass.', 'text-align: center; width: 600px; height: 100px; display: block; font-size: 14em; background-image: url(https://media.giphy.com/media/l0IydkTtMUaYmZqWk/giphy.gif)')
@proudlygeek
proudlygeek / hiring.js
Created January 24, 2019 16:52
Stuff for Konami Code
console.log('%c We\'re hiring dumbass.', 'text-align: center; width: 600px; height: 100px; display: block; font-size: 14em; background-image: url(https://media.giphy.com/media/l0IydkTtMUaYmZqWk/giphy.gif)')
@proudlygeek
proudlygeek / broccoli_rspec_formatter.rb
Created September 3, 2018 13:49
Broccoli Formatter 🥦
class BroccoliFormatter
RSpec::Core::Formatters.register self, :dump_pending, :dump_failures, :close, :dump_summary, :example_passed, :example_failed, :example_pending
def initialize(output)
@output = output << "\n"
end
def example_passed(_notification)
@output << ' 🥦 '
end
@proudlygeek
proudlygeek / http_client_debugger.rb
Created August 14, 2018 12:24
HTTPClient custom request debugger
class Debugger
def <<(line)
puts line
end
end
client = HTTPClient.new
debugger = Debugger.new
client.debug_dev = debugger
<!DOCTYPE html>
<html>
<body>
<h1>Test</h1>
</body>
<script>
alert(document.cookie);
</script>
</html>

Keybase proof

I hereby claim:

  • I am proudlygeek on github.
  • I am proudlygeek (https://keybase.io/proudlygeek) on keybase.
  • I have a public key ASCrhfj21Ci8vJKQ0K0MX-MDMwTLajvk5tfT2VJv9IoFiAo

To claim this, I am signing this object:

@proudlygeek
proudlygeek / borrow.rs
Last active July 18, 2016 08:06
Rust Ownership / Borrow
fn sum_vectors(a: Vec<i32>, b: Vec<i32>) -> (Vec<i32>, Vec<i32>, Vec<i32>) {
let mut result: Vec<i32> = vec![0; 3];
for (i, _item) in a.iter().enumerate() {
result[i] = a[i] + b[i];
}
(a, b, result)
}
<?php
$apiKey = getenv('OPENWM_API_KEY') || file_get_contents( 'apikey');
$apiURL = 'http://api.openweathermap.org/data/2.5/forecast/daily';
$lat = $_GET[ 'lat' ];
$lon = $_GET[ 'lon' ];
echo file_get_contents( $apiURL . '?lat=' . $lat . '&lon=' . $lon . '&units=metric&cnt=1&APPID=' . $apiKey );