This file contains hidden or 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
<?php | |
# Error handler | |
function custom_error_handler($errno, $errstr, $errfile, $errline) | |
{ | |
if (AppSettings::$env == 'dev') | |
{ | |
throw new ErrorException($errstr, 0, $errno, $errfile, $errline); | |
} | |
else |
This file contains hidden or 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
@interface NSMutableArray (Custom) | |
- (NSMutableArray *)replaceNullsWithObject:(id)object; | |
@end | |
@interface NSMutableDictionary (Custom) | |
- (NSMutableDictionary *)replaceNullsWithObject:(id)object; | |
@end |
This file contains hidden or 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 | |
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" |
This file contains hidden or 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
// | |
// 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 |
This file contains hidden or 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
// | |
// GameCCPhysicsNode.h | |
// RollingCandy | |
// | |
// Created by Gints Murans on 21/03/14. | |
// Copyright (c) 2014 Early Bird. All rights reserved. | |
// | |
#import "CCPhysicsNode.h" |
This file contains hidden or 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
#!/usr/bin/env python3 | |
import argparse | |
import subprocess | |
import time | |
import select | |
PATH_TO_TELEGRAM = '/root/tg/telegram' |
This file contains hidden or 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
<?php | |
const SESSION_EXPIRATION_TIME = 100; // Seconds | |
function session_expire() | |
{ | |
if (empty($_SESSION['last_visit'])) { | |
$_SESSION['last_visit'] = time(); | |
} | |
if ($_SESSION['last_visit'] + SESSION_EXPIRATION_TIME < time()) { |
This file contains hidden or 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
<?php | |
/** | |
* Returns fixed floating number with precision of $precision. Replaces "," to "." and " " to "". | |
* | |
* @param $input mixed | |
* @param $precision int | |
* @return float | |
*/ | |
function fixFloat($input, $precision = -1) |
This file contains hidden or 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
#!/usr/bin/env python3 | |
# Little library for email and sms (using SMSEagle - http://www.smseagle.eu/) notifications. | |
# Can be used as a command line or library. | |
# For this to work please set SMTP and SMSEAGLE parameters | |
import argparse | |
import smtplib | |
import json | |
from email.mime.text import MIMEText |
This file contains hidden or 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
CREATE OR REPLACE FUNCTION jsonb_array_search(json_arr jsonb, col TEXT, search_for TEXT) RETURNS boolean | |
LANGUAGE plpgsql IMMUTABLE AS $$ | |
DECLARE | |
rec jsonb; | |
len int; | |
ret boolean = false; | |
BEGIN | |
-- If json_arr is not an array, return false | |
BEGIN | |
len := jsonb_array_length(json_arr); |
OlderNewer