Skip to content

Instantly share code, notes, and snippets.

View galek's full-sized avatar
🧭
I'm ready for new discoveries

Nikolay Galko galek

🧭
I'm ready for new discoveries
View GitHub Profile
// Tests each segment for a hit. All calculations are done in screen space pixel coordinates
bool CollisionPath::hitTest(const ViewportPosition &selection_position) const
{
const Vector2 &mouse_pixel_pos = selection_position.getPixelPosition();
const Viewport &viewport = selection_position.getViewport();
const Camera &camera = viewport.getCamera();
const WorldLayer &layer = *getLayer();
for(auto iter = anchors.begin(); iter != anchors.end()-1; ++iter) {
const Vector2 &segment_begin =
@Novum
Novum / gist:1200562
Created September 7, 2011 13:31
Fast SSE pow for range [0, 1]
// Fast SSE pow for range [0, 1]
// Adapted from C. Schlick with one more iteration each for exp(x) and ln(x)
// 8 muls, 5 adds, 1 rcp
inline __m128 _mm_fastpow_0_1_ps(__m128 x, __m128 y)
{
static const __m128 fourOne = _mm_set1_ps(1.0f);
static const __m128 fourHalf = _mm_set1_ps(0.5f);
__m128 a = _mm_sub_ps(fourOne, y);
__m128 b = _mm_sub_ps(x, fourOne);
@bagobor
bagobor / gist:6452933
Created September 5, 2013 16:54
opengl txaa?
#version 330 core
#extension GL_ARB_shading_language_420pack: require
#extension GL_ARB_separate_shader_objects: require
#extension GL_ARB_shader_image_load_store: require
#extension GL_ARB_bindless_texture: require
#define ENABLE_BINDLESS_TEX
#define FRAGMENT_SHADER 1
#define ps_main main
#define PS_FST 0
#define PS_WMS 0
@nadar71
nadar71 / download.lua
Last active November 10, 2016 11:29 — forked from michael714/download.lua
-- download.lua by Michael Weingarden May 2014
local dropbox = require("dropboxModule")
local widget = require( "widget" )
-- Load the relevant LuaSocket modules (no additional files required for these)
local http = require("socket.http")
local ltn12 = require("ltn12")
_H = display.contentHeight
@michael714
michael714 / download.lua
Created May 24, 2014 23:13
Dropbox REST API module for Corona SDK
-- download.lua by Michael Weingarden May 2014
local dropbox = require("dropboxModule")
local widget = require( "widget" )
-- Load the relevant LuaSocket modules (no additional files required for these)
local http = require("socket.http")
local ltn12 = require("ltn12")
_H = display.contentHeight
@printesoi
printesoi / sort.cpp
Created November 26, 2012 23:02
Distributed sort in MPI
/*
* ===========================================================================
*
* Filename: sort.cpp
* Author: Dodon Victor, dodonvictor AT gmail DOT com
* Created: 11/22/2012 04:32:15 PM
* Editor: Vim 7.3
* Compiler: clang 3.2
* OS: Archlinux x86_64
*
@raicerk
raicerk / .gitlab-ci.yml
Created April 28, 2018 00:50 — forked from lennonjesus/.gitlab-ci.yml
Gitlab CI - Build Ionic 3 Project and generates apk files
# Gitlab CI - Build Ionic 3 Project and generates apk files
image: beevelop/ionic:latest
stages:
- deploy
cache:
untracked: true
key: "$CI_PROJECT_ID"
paths:
function getLine(offset) {
var stack = new Error().stack.split('\n'),
line = stack[(offset || 1) + 1].split(':');
return parseInt(line[line.length - 2], 10);
}
global.__defineGetter__('__LINE__', function () {
return getLine(2);
});
@reterVision
reterVision / insert_pg.go
Created July 5, 2014 08:18
A trivial program that uses goroutine to insert records into Postgres.
/*
Original idea from
http://www.acloudtree.com/how-to-shove-data-into-postgres-using-goroutinesgophers-and-golang/
*/
package main
import (
"log"
"time"
"os"
@JAForbes
JAForbes / readme.md
Last active January 13, 2021 00:06
Data Driven Entity Component System

Entities and Components

An entity is just a number.

There is a graph of components, indexed by the entity id.

All state is stored in one place.

var components = { Position: {}, Velocity:{}, Spite: {}, Timer: {}, ScreenShake: {}, RemoveComponents: {} }