Skip to content

Instantly share code, notes, and snippets.

View ghiboz's full-sized avatar
🍺
Focusing

Paolo Ghibaudo ghiboz

🍺
Focusing
View GitHub Profile
@ghiboz
ghiboz / gist:1213680
Created September 13, 2011 12:11
new instance of array
NSMutableArray *athletesTemp = [[NSMutableArray alloc] init];
self.athletes = athletesTemp;
[athletesTemp release];
@ghiboz
ghiboz / gist:1221456
Created September 16, 2011 07:37
SQL: reset autoincrement
-- cancello la load unit e azzero l'id autoincrementante
delete from dtLu where pLu > 0
DBCC CHECKIDENT ('dtLu', RESEED,0)
@ghiboz
ghiboz / gist:1221464
Created September 16, 2011 07:39
SQL: togliere autoincrement
-- attivo l'identity manuale
SET IDENTITY_INSERT dtBtc ON
-- inserisco
insert into dtBtc (pBtc, sBtc, pBtcStt)
values ( 0, '...', 0 )
-- tolgo l'identity manuale
SET IDENTITY_INSERT dtBtc OFF
@ghiboz
ghiboz / gist:1232051
Created September 21, 2011 13:42
store nsdate into db
// salvo su db
sqlite3_bind_double(updateStatement, 5, [[person birthdate] timeIntervalSince1970]);
// leggo da db
person.birthdate = [NSDate dateWithTimeIntervalSince1970:sqlite3_column_double(selectStatement, 5)];
@ghiboz
ghiboz / gist:1244517
Created September 27, 2011 07:18
RayTrace in MogreNewt
public float RayTrace(Vector3 position)
{
Vector3 start = position;
Vector3 end = position;
start.z = start.z + 20F;
end.z = end.z - 20F;
BasicRaycast ray = new BasicRaycast(m_World, start, end);
if (ray.FirstHit != null)
{
@ghiboz
ghiboz / 0_reuse_code.js
Created June 26, 2014 08:47
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ghiboz
ghiboz / grDs.mat
Created August 5, 2014 13:24
the grDS.mat is the main file
material grsDS
{
lod_values 0.1 2
diffuse 1 1 1 1
specular 0 0 0 0 1
ambient 1 1 1
emissive 0 0 0
scene_blend default
void Render::initShiny()
{
/// material factory setup
sh::OgrePlatform* platform = new sh::OgrePlatform("General", sBasePath + "data/common");
platform->setCacheFolder(PATHMANAGER::GetCacheDir());
mFactory = new sh::Factory(platform);
sh::Factory& fct = sh::Factory::getInstance();
fct.setReadSourceCache (true);
@ghiboz
ghiboz / setMat.mcr
Last active August 29, 2015 14:07
set ambient, diffuse e spec a 255 255 255
macroScript TestMaterial category:"ghiboz"
(
materialID = 1
print '-------------------'
for materialID=1 to meditmaterials.count do
(
if (classof meditMaterials[materialID] == Standardmaterial) then
(
if (meditMaterials[materialID] != undefined) then
(
@ghiboz
ghiboz / weldSmooth.mcr
Last active August 29, 2015 14:07
weld vertex and smooth the meshes
macroScript WeldSmooth category:"ghiboz"
(
for o in selection do
(
if( isKindOf o GeometryClass ) then -- weld only in geometry objects
(
if classof o.baseObject == Editable_Mesh then
(
print o.name
meshOp.weldVertsByThreshold o.mesh o.mesh.verts 0.001