Skip to content

Instantly share code, notes, and snippets.

/* Generated by Nim Compiler v1.7.3 */
#define NIM_INTBITS 64
#define NIM_EmulateOverflowChecks
#include "nimbase.h"
#include <stdio.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
let color = uint8((x / uiState.windowWidth) * 256)
let screen = newImage(512, 512)
let screenCtx = newContext(screen)
screenCtx.font = uiCtx.consoleFont
screen.fill(rgba(255, 255, 255, 255))
screen.fillText(
uiCtx.consoleFont.style(36, rgba(color, color, color, 255)),
$frameRate
)
var surface = createRGBSurface(0, cint 512, cint 512, 32, rmask, gmask, bmask, amask)
use "files"
use "collections"
class RecordType1
let spec_record_type: (U32, U32) = (0, 1)
var record_type: U8 = 0
new create(line: String val) =>
try
@chancyk
chancyk / glob.pony
Last active August 12, 2017 01:27
ponylang: Glob
use "time"
use "files"
use "glob"
actor Main
new create(env: Env) =>
let caps = recover val FileCaps.>set(FileRead).>set(FileStat).>set(FileLookup) end
@chancyk
chancyk / multiple_series_varying_data.elm
Created June 13, 2017 15:41
Plot multiple series with different data.
import Svg exposing (Svg, linearGradient, stop)
import Svg.Attributes exposing (id, stroke, offset, stopColor, stopOpacity)
import Plot exposing (..)
type alias MyData =
{ areaData : List ( Float, Float )
, lineData : List ( Float, Float )
}
@chancyk
chancyk / to_excel_date.py
Last active June 1, 2017 17:34
Convert an ISO8601 date to the Excel date representation.
from datetime import datetime, date
from dateutil.parser import parse
class ExcelDateException(Exception):
pass
def to_excel_date(iso_date):
"""Convert a date to the Excel representation of a date
@chancyk
chancyk / parsley_sql.py
Last active January 25, 2017 05:41
Python Parsley OMeta SQL Parser
"""
LICENSE
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
DESCRIPTION
This is a prototype, parsley implementation of a subset of a MySQL-like SQL syntax.
@chancyk
chancyk / threaded_lbbroker.py
Created January 13, 2017 18:45
PyZMQ Threaded Load-Balancing Broker
"""
Threaded Load-balancing Broker
"""
from __future__ import print_function
from threading import Thread
import zmq
@chancyk
chancyk / pyzmq_rpc.py
Last active May 24, 2020 06:39
PyZMQ RPC
"""
LICENSE: MIT
This is an experiment. Use at your own risk.
"""
import sys
import time
import zlib
import pickle
@chancyk
chancyk / contenteditable-error.elm
Created November 11, 2016 16:33
Runtime Error from Clearing a contenteditable DIV
{-| This code will reproduce issue https://github.com/elm-lang/core/issues/749
when the text from either div is cleared.
-}
import Html exposing (text)
import Html.App as App
import Html.Attributes exposing (contenteditable)
import Html.Events exposing (on)
import Json.Decode as Json