Skip to content

Instantly share code, notes, and snippets.

require "try-catch"
try {
function()
error('oops')
end,
catch {
function(error)
print('caught error: ' .. error)
@bilange
bilange / exactchange.go
Created October 24, 2012 16:52
Exact change calculation
/*
* Exact change calculator (recursion learning exercice)
* Eric Belanger // github.com/bilange // Twitter: @bilange
*
* This code has been build to demonstrate how to do recursion, for people who
* wants to know Go better via code examples. This code has been HIGHLY
* documented to help the learning process. Feel free to fork, base upon or
* otherwise copy this code! :-)
*
* This MAY be NOT the only way to do this task, so feel free to experiment!
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@jaw111
jaw111 / frame1.jsonld
Last active August 29, 2018 19:01
example skos tree in JSON-LD
{
"@context": {
"skos": "http://www.w3.org/2004/02/skos/core#"
},
"@type": "skos:ConceptScheme",
"skos:hasTopConcept": {
"@type": "skos:Concept"
}
}
@cvrebert
cvrebert / survey.md
Last active May 8, 2024 16:13
Click and focus behavior across browsers & OSes

Test apparatus: http://jsfiddle.net/hRub4/

(Windows = Windows 8.1 desktop)

  • Windows Chrome 39
    • Button focuses on click and via keyboard tabbing
    • Anchor focuses on click and via keyboard tabbing
  • Windows Firefox 30.0
    • Button focuses on click and via keyboard tabbing
    • Anchor focuses on click and via keyboard tabbing
  • Windows Internet Explorer 11
@Eun
Eun / Makefile
Last active May 16, 2016 10:41
Makefile
## MAKEFILE V 1.4 ##
BIN = a.out
CC = gcc
CPLUS = g++
LINK = g++
OBJC = $(shell find ./src -name "*.c" | sed 's/\.c/\.o/g' | sed 's/\.\/src\//\.\/obj\//g')
OBJCPP = $(shell find ./src -name "*.cpp" | sed 's/\.cpp/\.opp/g' | sed 's/\.\/src\//\.\/obj\//g')
OBJ = $(OBJC) $(OBJCPP)
@domenic
domenic / 0-github-actions.md
Last active May 26, 2024 07:43
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
@cevaris
cevaris / struct_as_map_key.go
Last active October 20, 2023 03:18
Golang: Using structs as key for Maps
package main
import "fmt"
type A struct {
a, b int
}
func MapStructValAsKey(){
// Notice: We are using value of `A`, not `*A`
@dtjm
dtjm / join_test.go
Last active July 23, 2024 19:31
Benchmarking various ways of concatenating strings in Go
package join
import (
"fmt"
"strings"
"testing"
)
var (
testData = []string{"a", "b", "c", "d", "e"}
@hnakamur
hnakamur / main.go
Last active February 12, 2023 00:15
A go example to stop a worker goroutine when Ctrl-C is pressed (MIT License)
package main
import (
"fmt"
"os"
"os/signal"
"time"
"golang.org/x/net/context"
)