Skip to content

Instantly share code, notes, and snippets.

Avatar
🐾
走るなんて好きだ!

RawToast

🐾
走るなんて好きだ!
View GitHub Profile
@RawToast
RawToast / reason_gl.web
Last active Jan 16, 2020
Getting window details from reasongl
View reason_gl.web
module Document = {
type t;
type element;
type window;
let window: window = [%bs.raw "window"];
let document: t = [%bs.raw "document"];
/* external setGlDebug : window => GlT.context => unit = "debugContext" [@@bs.set]; */
[@bs.val]
external getElementById : string => Js.nullable(element) =
"document.getElementById";
@RawToast
RawToast / free-monad.kt
Created Nov 17, 2017
Free Monads in Kotlin using Kategory
View free-monad.kt
import kategory.*
import org.junit.Test
import kotlin.test.assertEquals
sealed class Logo<out A> : HK<Logo.F, A> {
sealed class F private constructor()
data class MoveForward(val position: Position, val times: Int) : Logo<Position>()
data class TurnRight(val position: Position) : Logo<Position>()
@RawToast
RawToast / Encrypty.scala
Created Jul 17, 2017
KMS Encryption in Scala
View Encrypty.scala
import java.nio.ByteBuffer
import com.amazonaws.regions.Regions
import com.amazonaws.services.kms.AWSKMS
import com.amazonaws.services.kms.AWSKMSClientBuilder
import com.amazonaws.services.kms.model.{DecryptRequest, EncryptRequest}
object Encrypty extends App {
val kms: AWSKMS = AWSKMSClientBuilder.standard.withRegion(Regions.EU_WEST_2).build()
View Basic sbt file
name := "interest-calc"
version := "1.0"
scalaVersion := "2.11.8"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test"
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.13.4" % "test"
View Basic SonarQube Postgres Database Setup
# Simple SonarQube database and user creation for Postgresql
#
sudo -u postgres psql postgres
CREATE DATABASE sonar;
CREATE USER sonar WITH PASSWORD 'verysecret';
GRANT ALL PRIVILEGES ON DATABASE sonar TO sonar;
@RawToast
RawToast / HerokuApiKey
Created Oct 21, 2015
Add Encrypted Heroku API key to .travis.yml
View HerokuApiKey
travis encrypt <heroku_api_key> -r <account>/<repository> --add
@RawToast
RawToast / .travis.yml
Created Oct 21, 2015
Basic ruby on rails travis-ci config
View .travis.yml
language: ruby
rvm:
- 2.2.3
before_script:
- psql -c 'create database <application_name>_test;' -U postgres
test:
adapter: postgresql
database: <application_name>_test
username: postgres
View gist:86a70a34c1b4fe693e6e
int main(int argc, char *argv[]) {
int retVal = -1;
@autoreleasepool {
@try {
retVal = UIApplicationMain(argc, argv, nil, nil);
}
@catch (NSException* exception) {
NSLog(@"Uncaught exception: %@", exception.description);
NSLog(@"Stack trace: %@", [exception callStackSymbols]);
@RawToast
RawToast / CoreDataHelper.swift
Created Oct 2, 2015
In memory CoreData configuration for unit testing
View CoreDataHelper.swift
import Foundation
import CoreData
func setUpInMemoryManagedObjectContext() -> NSManagedObjectContext {
let managedObjectModel = NSManagedObjectModel.mergedModelFromBundles([NSBundle.mainBundle()])!
let persistentStoreCoordinator = NSPersistentStoreCoordinator(managedObjectModel: managedObjectModel)
do {
try persistentStoreCoordinator.addPersistentStoreWithType(NSInMemoryStoreType, configuration: nil, URL: nil, options: nil)
} catch {