Skip to content

Instantly share code, notes, and snippets.

View Geri-Borbas's full-sized avatar
💡

Geri Borbás Geri-Borbas

💡
View GitHub Profile
@Geri-Borbas
Geri-Borbas / any.html
Last active December 26, 2015 20:29
Google Analytics tracking code modifications for eppz! browser window size statistics.
<script src="http://eppz.eu/blog/wp-content/themes/twentytwelwe-eppz/eppz!window.js" type="text/javascript"></script>
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-12345678-9', 'domain.com');
eppz.trackWindowSizeWithDimensionIndex(1);
@Geri-Borbas
Geri-Borbas / writeDataToFileSafely.php
Last active August 29, 2015 13:57
Writes a file without the worry on simultaneous file writings.
/**
* Writes a file without the worry on simultaneous file writings.
*
* @param mixed $data - Data to put into the file.
* @param string $filePath - Path to the file to put data into.
* @param number $timeOut - The maximum time (milliseconds) until method attempts to write file (defaults to 1000).
* @return bool - Returns true if data has been written.
*/
function writeDataToFileSafely($data, $filePath, $timeOut = 1000)
{
@Geri-Borbas
Geri-Borbas / Report
Created April 14, 2014 17:50
Crash report for How to fix “Xcode quit unexpectedly while using the libclang.dylib plug-in.”? at http://stackoverflow.com/questions/23065373/how-to-fix-xcode-quit-unexpectedly-while-using-the-libclang-dylib-plug-in
Process: Xcode [1948]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 5.1.1 (5085)
Build Info: IDEFrameworks-5085000000000000~10
App Item ID: 497799835
App External ID: 520942841
Code Type: X86-64 (Native)
Parent Process: launchd [142]
Sample Rate: 44100
Format ID: lpcm
Format Flags: C
Bytes per Packet: 2
Frames per Packet: 1
Bytes per Frame: 2
Channels per Frame: 1
Bits per Channel: 16
// Get audio format description.
CMFormatDescriptionRef formatDescription = CMSampleBufferGetFormatDescription(sampleBuffer);
const AudioStreamBasicDescription format = *CMAudioFormatDescriptionGetStreamBasicDescription(formatDescription);
// Get sample count.
CMItemCount sampleCount = CMSampleBufferGetNumSamples(sampleBuffer);
AudioBufferList audioBufferList;
CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(
sampleBuffer,
2014-04-24 15:22:37.314 PeerKit[1262:1803] OAL Error: +[ALWrapper bufferDataStatic:format:data:size:frequency:]: Invalid Value (error code 0x0000a003)
2014-04-24 15:22:37.315 PeerKit[1262:1803] OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification. Resetting audio session.
2014-04-24 15:22:37.331 PeerKit[1262:1803] OAL Error: -[OALAudioSession setAudioSessionActive:]: Could not deactivate audio session: Error Domain=NSOSStatusErrorDomain Code=2003329396 "The operation couldn’t be completed. (OSStatus error 2003329396.)"
2014-04-24 15:22:37.333 PeerKit[1262:1803] OAL Error: -[ALBuffer initWithName:data:size:format:frequency:]: <ALBuffer: 0x176b7a80: buffer_1>: Failed to create an OpenAL buffer
2014-04-24 15:22:40.418 PeerKit[1262:3b03] sampleCount: 1024 duration:0.000000
2014-04-24 15:22:40.439 PeerKit[1262:1803] sampleCount: 1024 duration:0.046440
2014-04-24 15:22:40.462 PeerKit[1262:1803] sampleCount: 1024 duration:0.046440
2014-04-24 15:22:40.485 PeerKit[1262:1803] sampleCount: 10
@Geri-Borbas
Geri-Borbas / AudioFormatDescription.m
Last active August 29, 2015 14:00
Get a human readable `AudioStreamBasicDescription` description.
-(NSString*)descriptionForAudioFormat:(AudioStreamBasicDescription) audioFormat
{
NSMutableString *description = [NSMutableString new];
// From https://developer.apple.com/library/ios/documentation/MusicAudio/Conceptual/AudioUnitHostingGuide_iOS/ConstructingAudioUnitApps/ConstructingAudioUnitApps.html (Listing 2-8)
char formatIDString[5];
UInt32 formatID = CFSwapInt32HostToBig (audioFormat.mFormatID);
bcopy (&formatID, formatIDString, 4);
formatIDString[4] = '\0';
@Geri-Borbas
Geri-Borbas / BuildPostProcessor.cs
Last active March 22, 2020 17:12
Adds iOS Frameworks to Xcode project (on each Unity build).
//
// Copyright (c) 2017 eppz! mobile, Gergely Borbás (SP)
// http://www.twitter.com/_eppz
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, AR
//
// Copyright (c) 2017 eppz! mobile, Gergely Borbás (SP)
//
// http://www.twitter.com/_eppz
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
@Geri-Borbas
Geri-Borbas / Object.cs
Last active May 8, 2017 22:24
💡 Some notes on a more flexible, maintainable event dispatching method than using if or switch statements all around. Also, different dispatch rules can be easily plugged in and out.
//
// Copyright (c) 2017 eppz! mobile, Gergely Borbás (SP)
//
// http://www.twitter.com/_eppz
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE