Skip to content

Instantly share code, notes, and snippets.

View Tonkpils's full-sized avatar
🌍
Somewhere in the world doing a handstand

Leo Correa Tonkpils

🌍
Somewhere in the world doing a handstand
View GitHub Profile
@Tonkpils
Tonkpils / goroutines.go
Created June 11, 2015 00:33
Simple Goroutines examples
package main
import (
"fmt"
"time"
)
func longFunction(name string, dur time.Duration) {
fmt.Printf("Started %s: lasting %s\n", name, dur)
time.Sleep(dur)
@Tonkpils
Tonkpils / gist:4407806
Created December 29, 2012 16:10
++ what?
int main(void) {
int i = 0;
int x = i++;
//This will print i: 1 x: 0
printf("i: %d x: %d", i, x);
int i = 0;
int x = ++i;
@Tonkpils
Tonkpils / pro.sml
Created October 17, 2013 19:24
Finding this issue made me LOL
fun get_nth (words : string list, n : int) =
if n = 1
then (hd words)
else get_nth((tl words), n - 1)
fun date_to_string(date : int*int*int) =
let
val months = ["January", "February", "March", "April", "June",
"July", "August", "September", "October", "November", "December"]
val month = get_nth(months, #2 date)
@Tonkpils
Tonkpils / Class Instance Variables
Created November 5, 2013 16:24
Showing an example of class instance variables.
module Bar
def self.included(base)
base.extend(ClassMethods)
end
def event_name
self.class.event
end
module ClassMethods
@Tonkpils
Tonkpils / SNAKE.md
Last active April 8, 2016 15:57
Snake Case Challenge

Snake Case Challenge

$ time ruby snake_case.rb
184756
ruby snake_case.rb  0.05s user 0.01s system 94% cpu 0.061 total

Keybase proof

I hereby claim:

  • I am tonkpils on github.
  • I am tonkpils (https://keybase.io/tonkpils) on keybase.
  • I have a public key whose fingerprint is 6451 7398 DCF0 114B 80EE 3861 F7A8 09F9 E659 30D0

To claim this, I am signing this object:

@Tonkpils
Tonkpils / systemstackrails.rb
Last active April 16, 2021 14:10
SystemStackError reproduction script
# frozen_string_literal: true
## SystemStackError introduced by https://github.com/rails/rails/pull/41860
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }