Skip to content

Instantly share code, notes, and snippets.

@solkar
solkar / PlatformMonitor.cs
Created November 14, 2016 15:32 — forked from bzgeb/PlatformMonitor.cs
Example Platform Monitoring script
using UnityEngine;
using UnityEditor;
using System.Collections;
[InitializeOnLoad]
public class PlatformMonitor {
static BuildTarget cachedPlatform;
static PlatformMonitor() {
cachedPlatform = EditorUserBuildSettings.activeBuildTarget;
@solkar
solkar / DeletePlayerPrefs.cs
Created July 29, 2016 16:32
Add a command to Unity Editor to wipe out PlayerPrefs
//
//
// DeletePlayerPrefs, created by Karlos Zafra
//
//
using UnityEngine;
using UnityEditor;
public class DeletePlayerPrefs
@solkar
solkar / .gitconfig
Last active April 3, 2019 10:01
My gitconfig file
[user]
name = Karlos Zafra
email = [email protected]
[alias]
amend = !git log -n 1 --pretty=tformat:%s%n%n%b | git commit -F - --amend
br = branch
co = checkout
cob = checkout -b
continue = rebase --continue
@solkar
solkar / 81-C# Script-NewBehaviourScript.cs.txt
Last active August 25, 2016 04:20
My custom template for new MonoBehaviour
///
///
/// #SCRIPTNAME#, created by Karlos Zafra
///
//////
using UnityEngine;
using System.Collections;
public class #SCRIPTNAME# : MonoBehaviour
@solkar
solkar / gist:7110b2f29d64c1547d12
Last active December 10, 2019 19:06 — forked from alternegro/gist:3007373
XCode shortcuts

Xcode Shortcuts

Running

⌘R Run
⌘U Unit Test
⌘I Instruments Profile
⇧⌘B Analyze

Navigation

@solkar
solkar / gist:11084097
Created April 19, 2014 13:14
Filter and remove objects from a std::vector
// filter collidable tiles
std::vector<Point> toRemove;
for (size_t q = 0; q < freeTileCandidates.size(); ++q)
{
Point testTile = freeTileCandidates[q];
if( this->tileIsCollidable( testTile ) )
toRemove.push_back(testTile);
}
// erase filtered tiles
for (size_t q = 0; q < toRemove.size(); ++q)
@solkar
solkar / EventHandler.cpp
Created April 18, 2014 07:20
C++ callbacks
#include <functional>
class EventHandler
{
public:
void addHandler(std::function<void(int)> callback)
{
fCallback = callback
}
void performCallback()
#!/bin/bash
f=$(pwd)
sips --resampleWidth 512 "${f}/${1}" --out "${f}/iTunesArtwork"
sips --resampleWidth 1024 "${f}/${1}" --out "${f}/iTunesArtwork@2x"
sips --resampleWidth 57 "${f}/${1}" --out "${f}/Icon.png"
sips --resampleWidth 114 "${f}/${1}" --out "${f}/[email protected]"
sips --resampleWidth 29 "${f}/${1}" --out "${f}/Icon-Small.png"
sips --resampleWidth 58 "${f}/${1}" --out "${f}/[email protected]"
sips --resampleWidth 50 "${f}/${1}" --out "${f}/Icon-Small-50.png"
@solkar
solkar / NSMutableArray+Shuffling.h
Created February 4, 2014 06:50
shuffle NSMutableArray category
@interface NSMutableArray (Shuffling)
- (void)shuffle;
@end
@solkar
solkar / gist:8663683
Created January 28, 2014 07:49
Convert m4a to mp3 in OSX
ffmpeg -i input.mp4 output.mp3