Skip to content

Instantly share code, notes, and snippets.

RareSloth RareSloth

View GitHub Profile
@RareSloth
RareSloth / randomBenchmark.js
Created Dec 27, 2018
A benchmark test for finding a random record using nodejs and mongoose
View randomBenchmark.js
const mongoose = require('mongoose'),
Benchmark = require('benchmark'),
Promise = require('bluebird')
mongoose.connect('mongodb://localhost:27017/sandbox', {useNewUrlParser: true})
const Model = mongoose.model('Model', new mongoose.Schema({
name: String
}))
@RareSloth
RareSloth / Example.cs
Last active Dec 11, 2018
Extension methods for MonoBehaviour that make it easy to schedule a block of code at a given time in Unity
View Example.cs
// Runs the block of code at the end of the 10th FixedUpdate from now
myScript.InFixedUpdates(10, delegate
{
DoSomething();
DoSomethingElse();
});
@RareSloth
RareSloth / FURBroadcaster.h
Created Oct 14, 2017
ReplayKit recorder and broadcaster classes used in King Rabbit
View FURBroadcaster.h
//
// FURBroadcaster.h
// furdemption
//
// Created by Austin Borden on 10/8/16.
// Copyright © 2016 RareSloth LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <ReplayKit/ReplayKit.h>
@RareSloth
RareSloth / import_controller.rb
Last active Oct 1, 2017
Quick setup for importing a csv on a Rails server
View import_controller.rb
def import_csv
if params[:file]
ImportHelper.import_csv(params[:file])
end
end
@RareSloth
RareSloth / LocalizedScreenshotTest.m
Last active Mar 19, 2016
A cocos2d-objc method to save localized screenshot images
View LocalizedScreenshotTest.m
/**
* This assumes the test is being run on an iPad Pro (or simulator) so the largest screenshot
* doesn't get clipped. Base images with no text should be provided in the test resources with the -ipadhd extension.
* The output will be images in localized subfolders within the Documents folder of the simulator's sandbox.
*
* Run this method in any CCScene or full screen CCNode
*/
- (void)screenGrabAppStoreImages
{
// Our blank images are named "3.5_00-ipadhd.png", "3.5_01-ipadhd.png", "4_00-ipadhd.png", etc.
@RareSloth
RareSloth / key_flip_x.rb
Created Jun 9, 2015
Spine animation script that keys the flipX key at time 0 for all animations ending in "_west"
View key_flip_x.rb
#!/usr/bin/env ruby
require 'json'
if ARGV.count != 1
puts '[usage] ./key_flips_x.rb exported_skeleton.json'
raise RuntimeError
end
file_path = ARGV[0]
You can’t perform that action at this time.