Skip to content

Instantly share code, notes, and snippets.

@mrdoob
mrdoob / gist:718743
Last active July 23, 2023 06:53
Simplest HTML5 drawing tool
<html>
<style>
body {
margin: 0;
padding 0;
}
</style>
<body>
<script>
@mrdoob
mrdoob / gist:845802
Created February 27, 2011 01:09
video to looped animated gif
ffmpeg -i out.ogv -s 160x128 -pix_fmt rgb24 -ss 62.6 -t 3 -r 5 -loop 0 -f gif out.gif
convert -loop 0 -layers Optimize out.gif outopt.gif
@tsi
tsi / microTplEngine.js
Last active September 29, 2018 07:37
My micro jQuery templating engine
(function($) {
// My micro jQuery templating engine
// Include this script before your closing </body> tag.
// Usage:
//
// <section data-html="content"></section>
//
// This will load <html/content.html> into <section>
@christo
christo / ignoring.groovy
Last active April 1, 2020 21:54
Some compact Groovy syntax to ignore specific exceptions.
// you can make a construct for those
// times you want to ignore exceptions:
// here's the closure that can ignore things
def ignoring = { Class<? extends Throwable> catchMe, Closure callMe ->
try {
callMe.call()
} catch(e) {
if (!e.class.isAssignableFrom(catchMe)) {
throw e
@kohenkatz
kohenkatz / EchoServer.groovy
Created August 13, 2013 03:04
"Simple" Multi-threaded Echo server example in Groovy.
public class SimpleEchoServer implements Runnable {
private int port;
private LinkedList<Socket> openClients = new LinkedList<Socket>();
private boolean cleaningUp = false;
public SimpleEchoServer(int port) {
this.port = port;
}
@eliangcs
eliangcs / pyenv+virtualenv.md
Last active August 15, 2024 15:17
Cheatsheet: pyenv, virtualenvwrapper, and pip

Cheatsheet: pyenv, virtualenvwrapper, and pip

Installation (for Mac OS)

Install pyenv with brew

brew update
brew install pyenv
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active November 14, 2024 09:13
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
import macros
macro eval(s: string): expr =
result = parseStmt($s)
eval("echo 5")
@xem
xem / readme.md
Last active October 30, 2024 00:10
Maths & trigonometry cheat sheet for 2D & 3D games

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

@DawidMyslak
DawidMyslak / vue.md
Last active April 22, 2024 12:49
Vue.js and Vuex - best practices for managing your state

Vue.js and Vuex - best practices for managing your state

Modifying state object

Example

If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).

Example below explains implications for different implementations.