Skip to content

Instantly share code, notes, and snippets.

Dominik Picheta dom96

Block or report user

Report or block dom96

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View macro.nim
import macros
macro replace(node: untyped): untyped =
result = node
# StmtList
# Command
# Ident ident"echo"
# IntLit 42
result[0][1] = newStrLitNode("Hello World")
View braces.nim
#? braces
proc main() {
when (isMainModule) {
View gist:4eb5f8730d5dd3a395b1bba17419b37a
root@ubuntu-512mb-nyc3-01:~# curl -sSf | sh
choosenim-init: Downloading choosenim-0.2.2_linux_amd64
Info: Nim 0.17.2 already downloaded
Extracting nim-0.17.2.tar.gz
Building Nim 0.17.2
Building tools (nimble, nimgrep, nimsuggest)
Exception: Execution failed with exit code 1
... Command: ./koch tools -d:release
... Output: bin/nim c --noNimblePath -p:compiler -d:release -o:bin/nimsuggest nimsuggest/nimsuggest.nim
... Hint: used config file '/root/.choosenim/toolchains/nim-0.17.2/config/nim.cfg' [Conf]
View canvasjs.nim
import dom
CanvasRenderingContext* = ref object
fillStyle* {.importc.}: cstring
strokeStyle* {.importc.}: cstring
width* {.importc.}: int
height* {.importc.}: int
shadowColor* {.importc.}: cstring
View http_request.nim
var respChan: Channel[(string, string)]
var handlers: Table[string, proc (response: string)]
proc httpLoop() {.async.} =
while true:
let (received, resp) = respChan.tryRecv()
if received:
await sleepAsync(1000)
View selectors_explanation.nim
import selectors, net
Data = ref object of RootRef
someData: string
var selector = newSelector()
var sock = newSocket()
# The {} means "Don't notify me about any events for this sock", the sock is still registered though
selector.register(sock, {}, Data(someData: "Blah blah"))
dom96 / The Technical Interview Cheat
Last active Jan 1, 2019 — forked from TSiege/The Technical Interview Cheat
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.
View The Technical Interview Cheat

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
View gist:721f126bc75c2979ca50
import asyncnet, asyncdispatch, strtabs, parseutils, sha1, jester, htmlgen
WebSocketCallback = proc (client: WebSocket, message: WebSocketMessage) {.closure, gcsafe.}
WebSocketRecvClosure = proc (ws: WebSocket): Future[string] {.gcsafe, closure.}
WebSocketMessage = ref object
msg: string
View server.nim
import os, asyncnet, asyncdispatch
CBOnClientMessage* = proc(message: string)
proc handleClient(sockClient: AsyncSocket, cb: CBOnClientMessage) {.async.} =
while true:
let line = await sockClient.recvLine()
if "" == line:
View game.nim
import strutils
import lib
UpperScene = object of Scene
LowerScene = object of Scene
proc newUpperScene(): ref UpperScene =
result = new UpperScene
You can’t perform that action at this time.