Skip to content

Instantly share code, notes, and snippets.

Avatar
🐈

Jessica Claire Edwards jsscclr

🐈
  • Sydney, Australia
View GitHub Profile
@jsscclr
jsscclr / GAME_MASTER_v0_1.protobuf
Created Jul 16, 2016 — forked from anonymous/GAME_MASTER_v0_1.protobuf
Pokemon Go decoded GAME_MASTER protobuf file v0.1
View GAME_MASTER_v0_1.protobuf
Result: 1
Items {
TemplateId: "BADGE_BATTLE_ATTACK_WON"
Badge {
BadgeType: BADGE_BATTLE_ATTACK_WON
BadgeRanks: 4
Targets: "\nd\350\007"
}
}
Items {
@jsscclr
jsscclr / readme.md
Created Jul 15, 2016 — forked from xem/readme.md
Maths & trigonometry cheat sheet for 2D games
View readme.md

Conventions

  • o = [xo = 0, yo = 0] is the origin
  • 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;

@jsscclr
jsscclr / d3-server.js
Created Jul 6, 2016 — forked from caged/d3-server.js
Directly render and serve d3 visualizations from a nodejs server.
View d3-server.js
// Start `node d3-server.js`
// Then visit http://localhost:1337/
//
var d3 = require('d3'),
http = require('http')
http.createServer(function (req, res) {
// Chrome automatically sends a requests for favicons
// Looks like https://code.google.com/p/chromium/issues/detail?id=39402 isn't
// fixed or this is a regression.
@jsscclr
jsscclr / countPhotosForGeoLocation
Created Jul 6, 2016 — forked from philippschmitt/countPhotosForGeoLocation
Count all photos that are available on Flickr and Panoramio for a specific geo fence
View countPhotosForGeoLocation
/*
This script counts all photos that are available on Flickr and Panoramio for a specific geo fence and returns a JSON object with the data.
For convenience it's embedded in a little node.js server so that you can upload it to your server and use it as an API.
Here's an example url with all query attributes prefilled. Please use your own Flickr API key!
The location is the Berlin TV Tower (http://en.wikipedia.org/wiki/Fernsehturm_Berlin)
Example URL: http://piccounter-philippschmitt.rhcloud.com/?lat=52.520732&lon=13.409537&latRes=0.00015&lonRes=0.0003&flickrKey=60d03369d3e92b4578c8f2df2de5af66
@jsscclr
jsscclr / gist:67e06020cf16563badcde3b7cff2ada7
Created Jul 5, 2016 — forked from mattdesl/gist:10218005
pseudo-code for perlin-noise based generative impressionist paintings
View gist:67e06020cf16563badcde3b7cff2ada7
render
for each particle
x, y = particle.position
color = sample( colorMap, x, y )
noise = sample( noiseMap, x, y )
angle = noise * PI * 2
particle.velocity.add( cos(angle), sin(angle) )
@jsscclr
jsscclr / what-forces-layout.md
Created Jun 28, 2016 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@jsscclr
jsscclr / gist:9820fb32ddd823d626dcf0d7ca75462c
Created May 23, 2016 — forked from loretoparisi/gist:fe6e5cf889bb2c8f2099
Basic Javascript port of the MMCQ (modified median cut quantization) - quantize.js Copyright 2008 Nick Rabinowitz.
View gist:9820fb32ddd823d626dcf0d7ca75462c
/*!
* quantize.js Copyright 2008 Nick Rabinowitz.
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/
// fill out a couple protovis dependencies
/*!
* Block below copied from Protovis: http://mbostock.github.com/protovis/
* Copyright 2010 Stanford Visualization Group
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php
@jsscclr
jsscclr / .block
Created May 23, 2016 — forked from mbostock/.block
Lab and HCL Color Spaces
View .block
license: gpl-3.0
@jsscclr
jsscclr / ffmpeg_cheat_sheet.sh
Created May 14, 2016 — forked from indefinit/ffmpeg_cheat_sheet.sh
A working cheat sheet for ffmpeg
View ffmpeg_cheat_sheet.sh
#use case: converting image sequence to .mp4 video
#official documentation: https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images
#description:
# An image sequence follows the pattern, defaultCanvas0-000000000.png (9 zeros)
# video codec is libx264
# pixel format yuv420p
# output file is named out.mp4
ffmpeg -i 'defaultCanvas0-%9d.png' -c:v libx264 -pix_fmt yuv420p out.mp4
#if you want your image sequence to start on a different number than index 0, use the -start_number parameter
@jsscclr
jsscclr / randomcoords.cpp
Created May 14, 2016 — forked from bengfarrell/randomcoords.cpp
Random Coordinates C++ Node.JS AddOn
View randomcoords.cpp
#include <node.h>
#include <v8.h>
#include <stdio.h>
#include <stdlib.h>
using namespace v8;
Handle<Value> getRandomCoords2D(const Arguments& args) {
HandleScope scope;