Skip to content

Instantly share code, notes, and snippets.

View gintsmurans's full-sized avatar
👏
javascript

Gints Murāns gintsmurans

👏
javascript
View GitHub Profile
@gintsmurans
gintsmurans / telegram.py
Last active June 25, 2016 19:30
Telegram (tg) + python cli
#!/usr/bin/env python3
import argparse
import subprocess
import time
import select
PATH_TO_TELEGRAM = '/root/tg/telegram'
@gintsmurans
gintsmurans / GameCCPhysicsNode.h
Created March 22, 2014 08:04
Pause physics only in cocos2d v3
//
// GameCCPhysicsNode.h
// RollingCandy
//
// Created by Gints Murans on 21/03/14.
// Copyright (c) 2014 Early Bird. All rights reserved.
//
#import "CCPhysicsNode.h"
@gintsmurans
gintsmurans / PEShapeCache.h
Created March 21, 2014 04:05
Cocos2d v3 Physics Editor shape loader
//
// PEShapeCache.h
//
// Put together form the sources all over the internet by Gints Murans.
// No guarantees, of course.
//
/*
This class is used to load physics shapes from a plist created by the
@gintsmurans
gintsmurans / xcode-build-number.sh
Created March 27, 2013 06:57
Bash script for XCode build number automatic increment
#!/bin/bash
bN=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
bN=$(echo $bN + 1 | bc)
bN=${bN/\.*}
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $bN" "$INFOPLIST_FILE"
@gintsmurans
gintsmurans / NSArray+RemoveNulls.h
Last active December 11, 2017 09:00
Recursively remove nulls from NSArray and NSDictionary
@interface NSMutableArray (Custom)
- (NSMutableArray *)replaceNullsWithObject:(id)object;
@end
@interface NSMutableDictionary (Custom)
- (NSMutableDictionary *)replaceNullsWithObject:(id)object;
@end
@gintsmurans
gintsmurans / error_handler_helper.php
Created September 26, 2012 19:55
Turn php errors into exceptions; Codeigniter's implementation, but can be adapted for every other project.
<?php
# Error handler
function custom_error_handler($errno, $errstr, $errfile, $errline)
{
if (AppSettings::$env == 'dev')
{
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
else