Skip to content

Instantly share code, notes, and snippets.

@derhuerst
derhuerst / 00-about.md
Last active November 10, 2018 16:16
making asynchronous JS code synchronous

making asynchronous JS code synchronous

This script demonstrates challenges when inlining async function calls like setTimeout as well as a solution.

inspect-code does this.

Things to be solved:

  • setTimeout needs to return a timer id.
  • clearTimeout
@xem
xem / readme.md
Last active April 5, 2024 23:16
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;

@netcell
netcell / PhaserFillscreen.js
Last active February 22, 2024 23:02
Setting for Phaser.js to fill the screen on web browsers and Cocoon.js
/** Config part */
var FIXED_SIZE = 600;
var FIXED_MEASURE = 'Height';
/** Name maping */
var fixedName = FIXED_MEASURE;
var resName = fixedName === 'Height' ? 'Width' : 'Height';
var FIXED_NAME = fixedName.toUpperCase();
var RES_NAME = resName.toUpperCase();
@daz
daz / ffmpeg-x264.sh
Last active January 29, 2021 22:26
Cross-compile ffmpeg with x264 for Raspberry Pi 2
# Build environment. I use vagrant ubuntu/trusty64
sudo apt-get install build-essential git-core
sudo git clone https://github.com/raspberrypi/tools.git /opt/tools
export CCPREFIX="/opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-"
# Get ffmpeg and x264 repos
git clone git://source.ffmpeg.org/ffmpeg.git
@JasonGhent
JasonGhent / pi_qemu.sh
Last active March 24, 2024 14:36
OSX raspberry pi emulation via QEMU. v2 attempt @ https://gist.github.com/JasonGhent/922f38f57c8cb77b10f3
# pulled from http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/
# expanded via http://superuser.com/questions/690060/how-to-enable-network-with-a-raspberry-pi-emulated-on-qemu
# tested with 2015-02-16-raspbian-wheezy.zip on OSX Mavericks
# OSX terminal
brew install qemu
# kernel-qemu is a linux kernel compiled with ARM1176 support.
# learn more here: http://xecdesign.com/compiling-a-kernel/
curl -OL http://xecdesign.com/downloads/linux-qemu/kernel-qemu
curl -o raspbian_latest.zip -L http://downloads.raspberrypi.org/raspbian_latest
@bobbygrace
bobbygrace / trello-css-guide.md
Last active April 22, 2024 10:15
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

@wandernauta
wandernauta / sp
Last active April 16, 2024 15:37
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/usr/bin/env bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active March 27, 2024 06:36
A badass list of frontend development resources I collected over time.
@nielsbot
nielsbot / gist:4678311
Last active December 11, 2015 23:39
Create CGColor from HTML/CSS/Hex color string
static CGColorRef CGColorCreateWithCSSColor( NSString * string )
{
union {
struct {
#if LITTLE_ENDIAN
uint8 alpha ;
uint8 blue ;
uint8 green ;
uint8 red ;
#else