Skip to content

Instantly share code, notes, and snippets.

View EteimZ's full-sized avatar

Youdiowei Eteimorde EteimZ

View GitHub Profile
@gphan
gphan / GameOfLife.js
Created December 21, 2012 22:41
A simple implementation of Conway's Game Of Life in JavaScript and HTML5 Canvas
/* http://jsfiddle.net/4YuZp/ */
/*
<h1>Conway's Game of Life</h1>
<canvas id="screen" width="300px" height="300px">
</canvas>
<form>
<div>
<label for="chanceOfLife">% of Alive</label>
<input id="chanceOfLife" type="text" value="5"/>
<input id="random" type="button" value="Randomize" />
@tedmiston
tedmiston / nodejs-tcp-example.js
Last active April 7, 2026 15:41
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@iamnewton
iamnewton / bash-colors.md
Last active April 6, 2026 07:02
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@herbps10
herbps10 / admin.py
Created June 18, 2015 14:04
Setting up SQLAlchemy with Application Factory pattern and Blueprints
from flask import current_app, Blueprint, render_template
from database import db_session
from model import Product
admin = Blueprint('admin', __name__, url_prefix='/admin')
@admin.route('/')
def index():
product = db_session.query(Product).first()
@gkhays
gkhays / DrawSineWave.html
Last active January 21, 2026 21:36
Oscillating sine wave, including the steps to figuring out how to plot a sine wave
<!DOCTYPE html>
<html>
<head>
<title>Sine Wave</title>
<script type="text/javascript">
function showAxes(ctx,axes) {
var width = ctx.canvas.width;
var height = ctx.canvas.height;
var xMin = 0;
@wojteklu
wojteklu / clean_code.md
Last active April 14, 2026 00:12
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@christophberger
christophberger / container.go
Created October 30, 2016 15:41
A container in less than 60 lines of Go
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
@nick-paul
nick-paul / tic-tac-toe.hs
Created November 23, 2016 05:10
A simple tic-tac-toe game written in Haskell
-- Nicholas Paul
-- A simple tic-tac-toe game written in Haskell
import Data.List
import Data.Char
import Data.Time.Clock.POSIX
-- Main function. We will simply call our gameLoop with
-- an empty board
main = do
@mdonkers
mdonkers / server.py
Last active April 7, 2026 22:04
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@fnky
fnky / ANSI.md
Last active April 13, 2026 21:47
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27