Skip to content

Instantly share code, notes, and snippets.

View jokester's full-sized avatar
🌛
not my photo / still alive and with a cat now!!! (as of 2024-03)

Wang Guan jokester

🌛
not my photo / still alive and with a cat now!!! (as of 2024-03)
View GitHub Profile
module MonadTutorial where
{-
--------------------------------------------------------------------------------
WARNING: DO NOT PROCEED
-----------------------
It is strongly advised that pre-requisite exercises have been covered prior to
utilising this tutorial. Refusing this advice increases likelihood of a crash
@jokester
jokester / 12306.user.js
Created January 5, 2012 14:37 — forked from quietlynn/12306.user.js
12306 Auto Query => A javascript snippet to help you book ticket
/*
12306 Auto Query => A javascript snippet to help you book tickets online.
Copyright (C) 2011 Jingqin Lynn
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes Sizzle.js
require 'delegate'
class HiddenDelegator < SimpleDelegator
def initialize(obj)
super
end
def class
__getobj__.class
end
@martinsik
martinsik / apd-php54.diff
Created August 11, 2012 07:39
Patch file for APD 1.0.1 that fixes bugs for PHP 5.4
--- php_apd.c.orig 2004-09-28 05:25:59.000000000 +0200
+++ php_apd.c 2012-08-11 10:59:29.000000000 +0200
@@ -70,7 +70,7 @@
/* List of exported functions. */
-function_entry apd_functions[] = {
+zend_function_entry apd_functions[] = {
PHP_FE(override_function, NULL)
PHP_FE(rename_function, NULL)
@carlosmcevilly
carlosmcevilly / make-icon-sizes.sh
Last active March 7, 2016 05:41
Generate sized icons for iOS and Watch development using ImageMagick convert
#!/bin/bash
# IMPORTANT: the default options for convert might not give you the
# same quality you will get from Gimp or Photoshop. You might have
# to dig into the convert command line options and tweak them to
# suit what kind of conversion you want. Someday I will do that...
# for now this script is best used for making test icon suites.
# requires ImageMagick for the 'convert' command below.
# http://www.imagemagick.org or on OS X: brew install imagemagick
@jokester
jokester / android-build-settings.md
Last active March 20, 2018 06:15
Android build settings that works in both IDE and CI server

What is this for

  • Auto-generated version number for release builds
  • No need to include keystore / password in repository
  • The code should still build with no extra configuration

How it works

  • Version code / number are generated from the commit itself
  • Version / sign settings are injected as environment variables

Desugar Scala Expressions

Use the compiler

scala -Xprint:typer -e "class A(val i: Int)" prints the desugarred expression after the typer phase. Use scala -Xshow-phases to get a list of all phases.

Or use a macro in the REPL

Paste this into a REPL session or in a file loaded with the :load command:

@hisui
hisui / OperatorPrecedencePersers.scala
Last active September 6, 2020 17:41
Parser combinator for Operator-precedence
package jp.segfault.scala.util
import scala.util.parsing.combinator._
/**
* Parser combinator for Operator-precedence parser(http://en.wikipedia.org/wiki/Operator-precedence_parser).
*/
trait OperatorPrecedenceParsers extends Parsers {
trait Op[+T,U] {
@antishok
antishok / NODE_ENV production.md
Last active September 25, 2020 07:09
What does `NODE_ENV=production` do?
@rhuss
rhuss / alpine-jre-8
Last active January 3, 2021 13:03
The Holy Grail of a Minimal, Headless, OpenJDK JRE 8
# Build for 206 MB JRE 1.8.0_60 (192 MB in size) with Alping and glibc
FROM alpine:3.2
ENV JRE=jre1.8.0_60 \
JAVA_HOME=/opt/jre
# That's the an EA from OpenJDK.net
# Courtesy to https://github.com/frol/docker-alpine-oraclejdk8 from where the setup of glibc is borrowed