Skip to content

Instantly share code, notes, and snippets.

View Kequc's full-sized avatar

Kequc

View GitHub Profile
extends Node
enum TERRAIN_SHAPE { NONE, FLAT, PEAK, DROP, SLANT }
const QUAD_UVS: = PoolVector2Array([Vector2(0, 0), Vector2(1, 0), Vector2(1, 1), Vector2(0, 1)])
// My custom shader for implementing dithered alpha
shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_disabled,diffuse_burley,specular_schlick_ggx;
// Texture maps
uniform sampler2D texture_albedo : hint_albedo;
uniform sampler2D texture_masks : hint_white;
uniform sampler2D texture_normal : hint_normal;
// Parameters
{
"env": {
"node": true,
"es6": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 8
},
0000000000000000000000000111111111111111100000000000000000000000000000000000000000000000000000000000
0000000000000000000111111111111111111111111111111110000000000000000000000000000000000000000000000000
0000000000000111111111111111111111111111111111111111111111111100000000000000000000000000000000000000
0000000111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000
0000011111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000
0000011111111111111111111111111111111111122222222222222221111111111111111111111111111110000000000000
0000011111111111111111111111111222222222222222233333333333333333331111111111111111111111000000000000
0000111111111111111111222222222222222223333333333333333333333333333333333333311111111111000000000000
0000111111111111122222222222222333333333333333333333333333333333333333333333333333111111100000000000
0000111111111111122222333333333333333333333333333333333333333333333333333333333333311111100000000000
@Kequc
Kequc / current.js
Last active June 2, 2016 20:18
Callback hell example
router.post('/:id/title-image', (req, res, next) => {
lwip.open(req.file.buffer, 'jpg', (err, image) => {
if (err) { next(err); return; }
let ratio = (image.width() > 960 ? (960 / image.width()) : 1);
image.scale(ratio, (err, image) => {
if (err) { next(err); return; }
image.crop(image.width(), Math.min((image.width() / 2), image.height()), (err, image) => {
if (err) { next(err); return; }
image.toBuffer('jpg', { quality: 80 }, (err, buffer) => {
////
..........
.....................
..T.......T....T...........T...
..........................................
...........T........................................
.....T................T...............T........................
.........T......................
////
.........................................................
..............T........................................................
............................T..................T....................................
.T....................T.......................................T..................................
.....................T.....T...................T.........................................T........
............................................
@Kequc
Kequc / origin.js
Last active September 24, 2015 08:15
Find da memory leak
// `domains` is a global containing valid domains grouped by keys
// this module is instantiated via require at the top of some file and
// the following is run once per request:
// Origin.foundKey(blah, blah);
// some origin stuff
var _ = require('underscore');
@Kequc
Kequc / router.query.js
Last active August 29, 2015 14:16
For meteor
Router.query = (function(router) {
var current = function () {
return router.current();
};
var rawParams = function () {
return current().params.query;
};
var params = function () {
@Kequc
Kequc / gist:11083050
Last active August 29, 2015 14:00
Obj update in jQuery coffeescript
class MyApp.Update
constructor: (@obj, @attrs={}) ->
@obj.data ?= {}
@obj.isOwned = false
$.extend @attrs,
ownerId: (v) =>
@obj.isOwned = MyApp.account.signedIn v