Skip to content

Instantly share code, notes, and snippets.

@flagoworld
flagoworld / RangeStreamer.h
Last active May 1, 2019 02:48
AVAssetResourceLoaderDelegate - Stream from server that requires specific auth headers
//
// RangeStreamer.h
// iOS Player
//
// Created by Ryan Layne on 4/2/15.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
# Parse input
n = gets.strip.to_i
a = Array.new(n)
(0...n).each { |a_i|
a_t = gets.strip
a[a_i] = a_t.split(' ').map(&:to_i)
arr = a[a_i]
}
# Initialize variables
Hey guys!
I am a little stuck on Title Case checkpoint on Ruby Arrays.
“We will need to use conditional logic --if and else statements -- to make this work. Read the test specification carefully so you understand the conditional logic to be implemented.
Some helpful methods to use are:
String#downcase
String#capitalize
b=$(basename "$1")
echo -n "http://example.com/uploads/$b" | pbcopy
for i
do
b=$(basename "$1")
mv "$i" "/path/to/Uploads/$b"
done
import os
from threading import Thread
from time import sleep
import asyncio
FIFO_PATH = "/path/to/crash-log"
class FifoReader(Thread):
def __init__(self, path, crash):
super().__init__()
@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;
}