This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Function: al_transform_rotation | |
*/ | |
void al_transform_rotation(const ALLEGRO_TRANSFORM *trans, float* rotation) | |
{ | |
float t = *rotation; | |
*rotation = t - atan2f(trans->m[0][1], trans->m[0][0]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void bitmap_source_release_content(ALLEGRO_GC_BITMAPSOURCE *bitmap_source) | |
{ | |
if ( bitmap_source->type == BS_NORMAL ) | |
{ | |
if ( bitmap_source->name_to_bitmap ) | |
{ | |
/* free string key */ | |
AL_AATREE_ITERATOR* iterator = al_aa_begin(bitmap_source->name_to_bitmap); | |
while (iterator && al_aa_next(iterator)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://pin.it/zuSovQT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//From http://stackoverflow.com/questions/111102/how-do-javascript-closures-work | |
function sayHello2(name) { | |
var text = 'Hello ' + name; // Local variable | |
var say = function() { console.log(text); } | |
return say; | |
} | |
var say2 = sayHello2('Bob'); | |
say2(); // logs "Hello Bob" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.media.MediaCodec; | |
import android.media.MediaCodecInfo; | |
import android.media.MediaFormat; | |
import android.util.Log; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.FileOutputStream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (midiNote > 0) | |
{ | |
int octave = midiNote / 12; | |
int noteNum = midiNote % 12; | |
int normalizedNote; | |
if (octave % 2 == 0) | |
{ | |
normalizedNote = noteNum; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find -maxdepth 1 -type d | while read -r dir; do printf "%s:\t" "$dir"; find "$dir" -type f | wc -l; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Use /J to create a hard link pointing to a directory, also known as a directory junction: | |
mklink /J Link Target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class TestBehaviour : MonoBehaviour { | |
TestBehaviour() | |
{ | |
// Will be called in Editor(play in game view, stop and back to scene) and Game. | |
// Will also be called when script get recompiled. | |
Debug.Log("TestBehaviour ctor: " + System.DateTime.Now.Ticks); |
OlderNewer