Skip to content

Instantly share code, notes, and snippets.

View RawToast's full-sized avatar
🐾
走りたい!

RawToast

🐾
走りたい!
View GitHub Profile
@RawToast
RawToast / CoreDataHelper.swift
Created October 2, 2015 12:29
In memory CoreData configuration for unit testing
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 {
@RawToast
RawToast / gist:86a70a34c1b4fe693e6e
Created October 13, 2015 08:38
Catch everything iOS
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 / .travis.yml
Created October 21, 2015 09:20
Basic ruby on rails travis-ci config
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
@RawToast
RawToast / HerokuApiKey
Created October 21, 2015 09:43
Add Encrypted Heroku API key to .travis.yml
travis encrypt <heroku_api_key> -r <account>/<repository> --add
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"
@RawToast
RawToast / Encrypty.scala
Created July 17, 2017 12:30
KMS Encryption in 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()
@RawToast
RawToast / free-monad.kt
Created November 17, 2017 21:39
Free Monads in Kotlin using Kategory
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 / reason_gl.web
Last active January 16, 2020 05:34
Getting window details from reasongl
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";
# 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;
This file has been truncated, but you can view the full file.
mixed-port: 7890
socks-port: 7891
allow-lan: true
bind-address: "*"
ipv6: true
log-level: info
external-controller: 127.0.0.1:9090
experimental:
ignore-resolve-fail: true
cfw-latency-timeout: 3000