Skip to content

Instantly share code, notes, and snippets.

View sbusso's full-sized avatar
🤖
Crafting with AI friends

Stéphane Busso sbusso

🤖
Crafting with AI friends
View GitHub Profile
@sbusso
sbusso / Rakefile
Created December 7, 2019 21:34 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@sbusso
sbusso / Embedding GoLang into a Ruby application.md
Created November 12, 2018 02:37 — forked from schweigert/Embedding GoLang into a Ruby application.md
Embedding GoLang into a Ruby application - Blogpost to Magrathealabs

Go Title

I am passionate about Ruby, but its execution time compared to other languages is extremely high, especially when we want to use more complex algorithms. In general, data structures in interpreted languages become incredibly slow compared to compiled languages. Some algorithms such as ´n-body´ and ´fannkuch-redux´ can be up to 30 times slower in Ruby than Go. This is one of the reasons I was interested in embedding Go code in a Ruby environment.

For those who do not know how shared libraries operate, they work in a similar way as DLLs in Windows. However, they have a native code with a direct interface to the C compiler.

Note Windows uses the DLL system, and in this case, this does not necessarily have to be in native code.

One example is DLLs written in C#, which runs on a virtual machine. Because I do not use windows, I ended up not testing if it is poss

@sbusso
sbusso / _results
Created September 30, 2018 13:51 — forked from alexedwards/_results
SCS and Gorilla Sessions benchmarks
# SCS
BenchmarkSCSMemstore-8 200000 9573 ns/op 3643 B/op 49 allocs/op
BenchmarkSCSCookies-8 100000 23220 ns/op 7516 B/op 83 allocs/op
BenchmarkSCSRedis-8 30000 45783 ns/op 4459 B/op 76 allocs/op
BenchmarkSCSMySQL-8 300 5782698 ns/op 4382 B/op 73 allocs/op
BenchmarkSCSPostgres-8 500 3715685 ns/op 5585 B/op 96 allocs/op
# Gorilla
@sbusso
sbusso / Editor.vue
Created September 28, 2018 03:05 — forked from stevebauman/Editor.vue
VueJS 2 + Trix Editor V-Model Component
<template>
<div></div>
</template>
<script>
import Trix from 'trix';
export default {
props: ['value'],
@sbusso
sbusso / letitfail.go
Created September 24, 2018 21:58 — forked from campoy/letitfail.go
This example shows how to have a set of goroutines running concurrently and processing requests. Panics from goroutines are recovered and the worker is restarted. You can download it and run it directly using `go run letitfail.go`
package main
import (
"bufio"
"fmt"
"os"
"time"
)
const numWorkers = 3
@sbusso
sbusso / unixhttpc.go
Created September 24, 2018 11:23 — forked from teknoraver/unixhttpc.go
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"
@sbusso
sbusso / macapp.go
Created September 23, 2018 17:18 — forked from mholt/macapp.go
Distribute your Go program (or any single binary) as a native macOS application
// Package main is a sample macOS-app-bundling program to demonstrate how to
// automate the process described in this tutorial:
//
// https://medium.com/@mattholt/packaging-a-go-application-for-macos-f7084b00f6b5
//
// Bundling the .app is the first thing it does, and creating the DMG is the
// second. Making the DMG is optional, and is only done if you provide
// the template DMG file, which you have to create beforehand.
//
// Example use:
@sbusso
sbusso / bootstrap-wizard-powered-by-vue2.markdown
Last active September 5, 2023 15:12
Bootstrap Wizard powered by Vue2
@sbusso
sbusso / index.html
Created September 22, 2018 02:11
Simple register form
<div id="progress"></div>
<div class="center">
<div id="register">
<i id="progressButton" class="ion-android-arrow-forward next"></i>
<div id="inputContainer">
<input id="inputField" required autofocus />
<label id="inputLabel"></label>
@sbusso
sbusso / index.haml
Created September 22, 2018 02:09
Onboarding Screens
// A set of walkthrough screens in HTML/CSS/JS. A personal experiment with layering images, CSS3 transitions, & flexbox.
%button.open-walkthrough Start
.walkthrough.show.reveal
.walkthrough-pagination
%a.dot.active
%a.dot
%a.dot
%a.dot
%a.dot