Skip to content

Instantly share code, notes, and snippets.

View Judrummer's full-sized avatar

Tipatai Puthanukunkit Judrummer

  • Pomelo
  • Bangkok, Thailand
View GitHub Profile
@akexorcist
akexorcist / Constraint.kt
Created August 5, 2022 14:37
Kotlin utility for condition-based data selection with dynamic condition supports
interface Constraint<INPUT, OUTPUT> {
suspend fun invoke(input: INPUT): OUTPUT?
}
abstract class SatisfyConstraint<INPUT, OUTPUT> : Constraint<INPUT, OUTPUT> {
abstract suspend fun isSatisfied(input: INPUT): Boolean
abstract suspend fun process(input: INPUT): OUTPUT
override suspend fun invoke(input: INPUT): OUTPUT? =
@benasher44
benasher44 / ios.gradle
Last active April 30, 2019 04:23
iOS Gradle Utilities for Generating Fat Frameworks and dSYMs
afterEvaluate {
// Create tasks for creating fat frameworks and fat dsyms for sim and device
def binaryKinds = [
// config, sim task, device task
new Tuple('Debug', linkDebugFrameworkIosSim, linkDebugFrameworkIosDevice),
new Tuple('Release', linkReleaseFrameworkIosSim, linkReleaseFrameworkIosDevice),
]
data class ContextA(val valueA: String, val valueB: Int)
data class ContextB(val valueB: Int, val valueC: Int, val valueD: Double)
val theReader: Reader<Int, String> =
Reader().lift { b: Int -> "The number is $b!!!" }
val theReaderInA: Reader<ContextA, String> = theReader
.local(ContextA::valueB::get)
@akexorcist
akexorcist / index.js
Last active November 17, 2022 11:25
Axios post method requesting with x-www-form-urlencoded content type. See https://axios-http.com/docs/urlencoded
const axios = require('axios')
/* ... */
const params = new URLSearchParams()
params.append('name', 'Akexorcist')
params.append('age', '28')
params.append('position', 'Android Developer')
params.append('description', 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/')
params.append('awesome', true)
@wchargin
wchargin / Vex.jsx
Created December 10, 2015 07:15
proof-of-concept: rendering musical notes in React
import Vex from 'vexflow';
import React, {Component} from 'react';
const {
Accidental,
Formatter,
Stave,
StaveNote,
Renderer,