Skip to content

Instantly share code, notes, and snippets.

NSDateFormatter *f = [NSDateFormatter new];
f.dateFormat = @"M/d/yyyy";
NSLog(@"Date: %@", [f dateFromString:@"8/29/2014"]);
//Logs:
// Date: 2014-08-29 07:00:00 +0000
@flagoworld
flagoworld / gdb_php.log
Created March 19, 2014 17:33
Calling "php" gives "Illegal Instruction"
Starting program: /usr/bin/php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Program received signal SIGILL, Illegal instruction.
0xb6e0b5e0 in ?? () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
(gdb) bt
#0 0xb6e0b5e0 in ?? () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
Cannot access memory at address 0x0
#1 0xb6e07fc4 in OPENSSL_cpuid_setup () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
@flagoworld
flagoworld / gist:9480365
Created March 11, 2014 06:04
For Loops
//A for loop is a loop dictated by 3 expressions
for(
//This is executed once at the beginning of the loop
var i=0;
//The loop continues as long as this evaluates to TRUE
i<5;
//This is executed at the end of every iteration
++i
)
{
<html>
<br>
<body>
<?php
$supers=array
(
"Earth"=>array('The Hulk', 'Captain America', 'Black Widow', 'Hawkeye'),
@flagoworld
flagoworld / ook_galaxy.txt
Created January 19, 2014 02:42
Procedural galaxy generator
Procedural galaxy generator
1. Randomly create systems using algorithm that approximates the shape of a galaxy
⁃ If point is too close to the solar system, don’t add it
⁃ Choose a system type to add
⁃ Star type? Black hole?
⁃ Check for nearby systems
⁃ If system is very close to another system
⁃ Add up to a couple planets, some debris, and another star at the center
@flagoworld
flagoworld / draw_line.c
Last active December 30, 2015 10:29
Draw line from entity position to 0,0 - no line being drawn, no glErrors
//Draw Lead Angle
glUseProgram(ook->solid_color->program);
glBindVertexArray(lead_angle_vao);
float lead_verts[]=
{
ook->player->target->pos.x,ook->player->target->pos.y,
0,0
};
@flagoworld
flagoworld / main.c
Created November 6, 2013 23:59
swillits
int main(int argc, const char * argv[])
{
printf("Start\n");
for(int i=0;i<123335423;++i)
{
int s=(int)(float)i;
if(s!=i)
printf("%i\n",s);
}
OOKVec3 matrix_unproject(GLuint fbo,OOKVec3 camera,int x,int y,Z_DEPTH z)
{
int viewport[4];
float winZ;
switch(z)
{
case Z_NEAR:
winZ=0.0f;
break;
@flagoworld
flagoworld / impact.c
Last active December 24, 2015 06:58
Damaging a ship works like this, i hope...
//Energy = radiation energy released from impact, MJ
//Shield = shield absorbtion capacity, MJ
//Hull = amount of stress the hull can receive before collapsing, MJ
shield -= energy
if(shield < 0)
{
energy = -shield;
shield = 0;
}
{
beforeSend: function (xhr, s) {
if (Object.prototype.toString.call(s.data).slice(8, -1) != 'FormData') {
s.data = csrfMagicName + '=' + csrfMagicToken + '&' + s.data;
} else {
s.data.append(csrfMagicName, csrfMagicToken);
}
}
}