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
#include <SDL.h> | |
#include <SDL_mixer.h> | |
#include <string> | |
#include <iostream> | |
Mix_Music *music = nullptr; | |
int main(int argc, char* argv[]) { | |
if (SDL_Init(SDL_INIT_AUDIO) < 0) { | |
return -1; |
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
#include <SFML/Audio.hpp> | |
#include <SFML/System.hpp> | |
#include <memory> | |
#include <fstream> | |
#include <iostream> | |
#include <string> | |
#include <algorithm> | |
class MyStream: public sf::InputStream | |
{ |
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 TileMapMeshBuilder { | |
private static int vertsByTile = 4; | |
private Transform parentTransform; | |
private TileMap tileMap; | |
private Material tileMaterial; |
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 System.Collections; | |
using System.Runtime.Serialization.Formatters.Binary; | |
using System.IO; | |
using UnityEngine; | |
using UnityEngine.Networking; | |
public class NetworkClient : MonoBehaviour { | |
public string host = "127.0.0.1"; | |
public int port = 8000; |
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
/** @const */ var ONE = 1; | |
/** | |
* A function to add 1 to a number. | |
* @param {number} n a number to be added. | |
* @return {number} The number + 1. | |
*/ | |
var addOne = function (n) { | |
return n + ONE; | |
} |
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
class Fluffy f where | |
furry :: (a -> b) -> f a -> f b | |
-- Exercise 1 | |
-- Relative Difficulty: 1 | |
instance Fluffy [] where | |
furry _ [] = [] | |
furry f (x:xs) = (f x):(furry f xs) | |
-- Exercise 2 |
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
-- IO (Maybe Integer Stack) | |
-- I can't find the code currently I am basing this off of, but I wanted to be | |
-- able to learn more about using StateT along with Maybe types. | |
import Control.Monad.State | |
main :: IO () | |
main = runStateT code Nothing >> return () | |
code :: StateT (Maybe [Integer]) IO () | |
code = do |
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
#lang racket | |
;; tru = \t. \f. t | |
(define tru | |
(lambda [t] | |
(lambda [f] t))) | |
;; fls = \t. \f. f | |
(define fls | |
(lambda [t] |
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
(def base62-alphabet | |
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") | |
(defn num->base62 [x] | |
(letfn [(base-conv [curr q] | |
(if (>= 0 q) curr | |
(recur (conj curr (nth base62-alphabet (rem q 62))) (quot q 62))))] | |
(base-conv '() x))) |
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
(defun make-adder (x) | |
(lambda (y) (+ x y))) | |
(defun add-5 (x) | |
(funcall (make-adder 5) x)) | |
(defun add-6 (x) | |
(funcall (make-adder 6) x)) | |
(add-5 20) |
NewerOlder