Skip to content

Instantly share code, notes, and snippets.

View knshiro's full-sized avatar
🍷
Creating a network for international Food and Beverage professionals

Ugo Bataillard knshiro

🍷
Creating a network for international Food and Beverage professionals
View GitHub Profile
#!/usr/bin/env ruby
require 'bundler/setup'
require 'cloudformation-ruby-dsl/cfntemplate'
require 'cloudformation-ruby-dsl/spotprice'
require 'cloudformation-ruby-dsl/table'
def tags_to_properties(tags)
tags.map { |k,v| {:Key => k, :Value}}
end
@knshiro
knshiro / build.sbt
Created August 5, 2015 08:35
Publish a deb with sbt and sbt-native-packager to bintray
import _root_.bintray.Bintray
enablePlugins(JavaAppPackaging, JDebPackaging)
name := "my-project"
maintainer := "My name <[email protected]>"
packageSummary := "Super package"
@knshiro
knshiro / release.sbt
Last active June 1, 2016 22:08
Make sbt-release work with sbt-git versioning.
import sbtrelease._
import ReleaseKeys._
import Utilities._
import ReleaseStateTransformations._
val gitVersionString = """enablePlugins(GitVersioning)
git.baseVersion := "%s""""
def writeVersion(st: State, versionString: String) {
@knshiro
knshiro / keybase.md
Created March 25, 2016 06:32
Keybase identity

Keybase proof

I hereby claim:

  • I am knshiro on github.
  • I am knshiro (https://keybase.io/knshiro) on keybase.
  • I have a public key whose fingerprint is 0E28 37F4 DBF1 C3D2 2976 B4DC 28A0 C86D 6FFE 979E

To claim this, I am signing this object:

@knshiro
knshiro / association_loader.rb
Created May 2, 2019 05:34 — forked from theorygeek/association_loader.rb
Preloading Associations with graphql-batch
# frozen_string_literal: true
class AssociationLoader < GraphQL::Batch::Loader
attr_reader :klass, :association
def initialize(klass, association)
raise ArgumentError, "association to load must be a symbol (got #{association.inspect})" unless association.is_a?(Symbol)
raise ArgumentError, "cannot load associations for class #{klass.name}" unless klass < ActiveRecord::Base
raise TypeError, "association #{association} does not exist on #{klass.name}" unless klass.reflect_on_association(association)
@klass = klass
@knshiro
knshiro / docker-compose.yml
Last active May 15, 2020 02:05
Docker compose for metabase and mysql (bonus phpyadmin)
version: "2.1"
services:
mysql-db:
image: mariadb:10.5
volumes:
- ./mysql_data:/var/lib/mysql
restart: always
ports:
- 3307:3306
@knshiro
knshiro / queryByPrefix.ts
Created October 1, 2020 10:12
Firebase prefixed case sensitive query
import type firebase from "firebase";
function findUpperBound(s: string): string {
if (!s.length) {
return s;
}
const c = String.fromCharCode(s.charCodeAt(s.length - 1) + 1);
return s.substring(0, s.length - 1) + c;
}