Skip to content

Instantly share code, notes, and snippets.

@nrk
nrk / gist:31175
Created December 2, 2008 16:53
A function in Lua similar to PHP's print_r
-- A function in Lua similar to PHP's print_r, from http://luanet.net/lua/function/print_r
function print_r ( t )
local print_r_cache={}
local function sub_print_r(t,indent)
if (print_r_cache[tostring(t)]) then
print(indent.."*"..tostring(t))
else
print_r_cache[tostring(t)]=true
if (type(t)=="table") then
@aras-p
aras-p / gist:783784
Created January 18, 2011 00:31
GLSL Bumped Specular Initial
#ifdef VERTEX
attribute vec4 a_position;
attribute vec2 a_uv;
attribute vec3 a_normal;
attribute vec4 a_tangent;
uniform mat4 u_mvp;
uniform mat4 u_world2object;
uniform vec4 u_worldlightdir;
uniform vec4 u_worldcampos;
@Munawwar
Munawwar / ExcelDataReader.cs
Last active January 14, 2020 12:19
C# - Excel Data Reader Library - Convert Excel (XLSX or XLS) to CSV
/*
* Dependency : Excel Data Reader from http://exceldatareader.codeplex.com/
* You must add the references to the Dlls (downloaded from the link above) with Visual Studio.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Excel;
@coldnebo
coldnebo / Default (Linux).sublime-keymap
Created August 10, 2011 23:20
simple scripts to prettify your xml and json in sublime text 2
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
@jonashaag
jonashaag / 0-howto-listfield-django-admin.rst
Created September 7, 2011 09:41
Howto use ListFields in Django's admin

Howto use ListFields in Django's admin

Problem

Consider this blog post model:

models.py

require "try-catch"
try {
function()
error('oops')
end,
catch {
function(error)
print('caught error: ' .. error)
@gourneau
gourneau / downloadChunks.py
Created December 4, 2011 18:33
Download large files with Python urllib2 to a temp directory
import os
import urllib2
import math
def downloadChunks(url):
"""Helper to download large files
the only arg is a url
this file will go to a temp directory
the file will also be downloaded
in chunks and print out how much remains
@kengonakajima
kengonakajima / moai_3d_simple_bench.lua
Created January 8, 2012 00:25
moai 3D simple benchmark from samples/test/cube-3d/main.lua
--[[---
Simple 3D benchmark based on samples/test/cube-3d.
- Video: http://www.youtube.com/watch?v=Fn54jJYw5y8&list=UUtHX3tIuYEScozlr4GqfF1Q
- Machine: macbook pro 2.53GHz i5, NVIDIA GeForce GT 330M 256 MB
- Benchmark spec
- num of props: 150
- cube per prop : 8x8x8 = 512
- total num of triangles: 12 x 512 x 150 = 921K
- frame rate: 60fps
@sarva
sarva / multipart_uploads_test.py
Created January 21, 2012 03:32
Streaming multiple files (multipart/form-data) PUT uploads to Tornado (uses a fork that supports body streaming)
"""
This example requires the body-streaming tornado fork at https://github.com/nephics/tornado.
Refer to http://groups.google.com/group/python-tornado/browse_thread/thread/791c67cb86c2dea2.
Supports uploading an unlimited number/size of files in a single
PUT multipart/form-data request. Each file is processed as the stream
finds the part in the form data.
==USAGE==
@Deco
Deco / coroutine_scheduler.lua
Created February 13, 2012 16:38
Lua Coroutine Scheduler
pcall(require,"socket")
local coroutine_scheduler = {
_NAME = "coroutine_scheduler.lua"
_VERSION = "1.0.0",
}
local Scheduler
do Scheduler = setmetatable({}, {
__call = function(class)