Skip to content

Instantly share code, notes, and snippets.

View hugocf's full-sized avatar

Hugo Ferreira hugocf

View GitHub Profile
@rcarmo
rcarmo / archive.txt
Created March 18, 2016 23:07
Epic Commits from @dramalho
061997d DELEGATE ALL THE THINGS
092aa231f wait, wrong place
09e7fd3 RERECORD ALL THE THINGS!!!
0c27fb3 yeah, fix things will ya
0f4549133 New ascii art task (\!important stuff) , and a few DAO tweaks (mino...
12aa7ef34 LE NONNNNNN LE MADNESS
13233e7 Less PHP
154c535 Once more, now with feeling and a proper master head
184e754 Dear Past-Friday David :Remember the textarea that seemed totally random and misterioys? It was $.ajax... obviously
19a8700 MAKE IT BIGGER
@bsneed
bsneed / Timings.txt
Last active January 9, 2016 17:29
Performance Comparison of Swift JSON->Model frameworks.
Time to decode 10,000 Person struct's from JSON:
Argo (Simple): 8.563 seconds
measureBlock {
let _ : [Person]? = decode(data)
}
Argo (Decomp'd): 3.344
measureBlock {
let json: Argo.JSON = JSON.parse(data)
@trumanw
trumanw / HexStringUtil.scala
Created April 20, 2015 07:08
String to hex bytes String in Scala.
object HexStringUtil {
// convert normal string to hex bytes string
def string2hex(str: String): String = {
str.toList.map(_.toInt.toHexString).mkString
}
// convert hex bytes string to normal string
def hex2string(hex: String): String = {
hex.sliding(2, 2).toArray.map(Integer.parseInt(_, 16).toChar).mkString

EDIT from 2019: Hi folks. I wrote this gist for myself and some friends, and it seems like it's gotten posted somewhere that's generated some (ahem, heated) discussion. The whitespace was correct when it was posted, and since then GitHub changed how it formats <pre> tags. Look at the raw text if you care about this. I'm sure someone could tell me how to fix it, but (thank you @anzdaddy for suggesting a formatting workaround) honestly this is a random throwaway gist from 2015, and someone more knowledgable about this comparison should just write a proper blog post about it. If you comment here I'll hopefully see it and stick a link to it up here. Cheers. @oconnor663

Here's the canonical TOML example from the TOML README, and a YAML version of the same.

title = "TOML Example"
 
@lavalamp
lavalamp / The Three Go Landmines.markdown
Last active February 16, 2024 12:16
Golang landmines

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
@davidcunha
davidcunha / data-structures-summary.md
Last active May 13, 2022 04:36
Data Structures Summary

General purposes data structures

Linked Lists

  • small amount of data, not predictable
  • used when data is frequently inserted and deleted
  • searching is slow
  • the insertion order matters when searching

Arrays

  • searching and deletion are slow
@bobbygrace
bobbygrace / trello-css-guide.md
Last active April 22, 2024 10:15
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

@davidallsopp
davidallsopp / Shrinking.scala
Last active January 30, 2024 13:25
Solutions to the ScalaCheck problem that shrinking failing values may generate invalid values, because the constraints of the generator are not respected. This is for using ScalaCheck from within ScalaTest.
import org.scalatest._
import prop._
import org.scalacheck.Arbitrary._
import org.scalacheck.Gen
/**
* Solutions to the ScalaCheck problem that shrinking failing values may generate
* invalid values, because the constraints of the generator are not respected.
*
* See also http://stackoverflow.com/questions/20037900/scalacheck-wont-properly-report-the-failing-case
@mchambers
mchambers / serializer.swift
Created June 25, 2014 07:49
A simple, limited model-to-JSON serializer in Swift.
// Here we'll use Swift's IDE-supporting reflect()
// function to build a basic JSON serializer.
// Per the fine engineers at WWDC, Swift's reflection support
// exists purely to support the IDE and the Playground. But
// we can have some fun with it anyway. ;)
class SerializerBase {
}
@staltz
staltz / introrx.md
Last active May 2, 2024 12:31
The introduction to Reactive Programming you've been missing