Skip to content

Instantly share code, notes, and snippets.

@kenjij
kenjij / Firebase.md
Last active November 2, 2022 20:41
Firebase REST authentication
@manuerumx
manuerumx / postJSON.cs
Last active October 20, 2021 05:39
Unity 3D example POST JSON Data to a Server with http Auth
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class goLevel : MonoBehaviour {
//With the @ before the string, we can split a long string in many lines without getting errors
private string json = @"{
'hello':'world',
'foo':'bar',
'count':25
attribute vec4 a_position;
attribute vec2 a_texCoord;
attribute vec2 a_texCoord1;
varying vec2 v_texture_coord;
varying vec2 v_texture_coord1;
void main(void)
{
gl_Position = CC_MVPMatrix * a_position;
v_texture_coord.x = a_texCoord.x;
@prespondek
prespondek / myshader.cpp
Last active May 30, 2016 06:35
Apply Shader Cocos2DX
...
// create mesh
Sprite3D* mesh = Sprite3D::create("mymesh.c3b");
// create the shader
GLProgram* shader = GLProgram::createWithFilenames("shaders/lightmap.vert","shaders/lightmap.frag");
// apply shader to mesh
GLProgramState* state = GLProgramState::create(shader);
mesh->setGLProgramState(state);
@neon-izm
neon-izm / GameWindowMover.cs
Created August 13, 2014 08:31
unity editor script: UnityEditor GameView automatically move to "Rift DK2 Extend Display"
using UnityEngine;
using UnityEditor;
//Version 0.21 | twitter:@izm update for DK2
//Version 0.2 | s.b.Newsom Edition
//Source from http://answers.unity3d.com/questions/179775/game-window-size-from-editor-window-in-editor-mode.html
//Modified by seieibob for use at the Virtual Environment and Multimodal Interaction Lab at the University of Maine.
//Use however you'd like!
@fqrouter
fqrouter / worker nginx conf
Last active February 3, 2024 06:11
Youtube Reverse Proxy
resolver 8.8.8.8;
location /video/ {
if ($request_uri ~ "^/video/(.+?)/.+") {
set $upstream_host $1.googlevideo.com;
add_header Content-Disposition "attachment; filename=video.mp4;";
}
rewrite /video/.+?/(.+)$ /$1 break;
proxy_buffering off;
proxy_pass https://$upstream_host;
proxy_set_header Host $upstream_host;
@bamboo
bamboo / MyColorSchemes.cs
Last active January 4, 2016 10:18
API based way of extending Livity color schemes. Save this file to a Editor/ folder inside your project and after refreshing the new color schemes should be available in the command palette and preferences dialog. Change and refresh to your liking. (It should be simpler I know, please bear with me!!! :))
using Livity.Collections;
using Livity.Composition;
using Livity.Text.Logic;
using Livity.Text.UI.Engine;
using Livity.Text.UI.Engine.Internal;
using UnityEngine;
namespace Livity.Mine
{
[Export(typeof(IColorSchemeProvider))]
@sahat
sahat / client.js
Last active February 23, 2022 17:09
Calculate client-server latency using socket.io
var socket = io.connect('http://localhost');
var startTime;
setInterval(function() {
startTime = Date.now();
socket.emit('ping');
}, 2000);
socket.on('pong', function() {
latency = Date.now() - startTime;
@theodox
theodox / silencer.py
Created January 2, 2014 18:42
suppress stdout and stderr stdout and stderr are redirected into StringIOs. At exit their contents are dumped into the string fields 'out' and 'error' Typically use this via the with statement: For example:: with Silencer() as fred: print stuff result = fred.out note that if you use a silencer to close down output from the logging module, you s…
import sys
from StringIO import StringIO
class SilencedError ( Exception ):
pass
class Silencer( object ):
'''
suppress stdout and stderr
@marcusmoller
marcusmoller / gist:6622766
Last active November 17, 2019 15:58
A small sprite combiner written in shell. Used on: http://opengameart.org/content/700-sprites
#!/bin/sh
for f in *.gif
do
short=${f:0:4}
if ls $short".png" &> /dev/null; then
echo "file exists"
else
montage -tile x1 -geometry +0+0 -background none $short*.gif $short.png
convert $short.png -transparent white $short.png