Skip to content

Instantly share code, notes, and snippets.

View mika76's full-sized avatar
🤖
Coding...

Mladen Mihajlović mika76

🤖
Coding...
  • Serbia
  • 17:44 (UTC +02:00)
View GitHub Profile
@mika76
mika76 / lua.json
Last active March 14, 2020 09:39
Corona SDK snippets for VS Code
{
"audio.dispose": {
"body": "audio.dispose( ${1:audioHandle} )",
"description": "Releases audio memory associated with the handle.",
"prefix": "audio.dispose"
},
"audio.fade": {
"body": "audio.fade( ${1:[ { [channel=c] [, time=t] [, volume=v ] } ]} )",
"description": "This fades a playing sound in a specified amount to a specified volume. The audio will continue playing after the fade completes.",
"prefix": "audio.fade"
@mika76
mika76 / debugconsole.lua
Last active May 9, 2018 11:05 — forked from HoraceBury/debugconsole.lua
Debug Print Console
-- debug console
local widget = require("widget")
local lib = {}
local originalPrintFunc = print
local debugPrintFunc = nil
local showingDebugConsole = false
@mika76
mika76 / Vector2D.lua
Created May 3, 2018 18:49 — forked from brandontreb/Vector2D.lua
A simple Vector2D class used in Corona SDK games.
Vector2D = {}
function Vector2D:new(x, y)
local object = { x = x, y = y }
setmetatable(object, { __index = Vector2D })
return object
end
function Vector2D:copy()
return Vector2D:new(self.x, self.y)
@mika76
mika76 / Program.cs
Created May 3, 2018 08:59 — forked from mattjohnsonpint/Program.cs
Airport Time Zones
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using GeoTimeZone; // Import from Nuget package "GeoTimeZone" (https://github.com/mj1856/GeoTimeZone)
using TimeZoneConverter; // Import from Nuget package "TimeZoneConverter" (https://github.com/mj1856/TimeZoneConverter)
namespace AirportTimeZones.DataBuilder
{
; Script genferated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
AppName=Microsoft Visual Basic 6.0
AppVerName=Microsoft Visual Basic 6.0
AppPublisher=Microsoft Corporation
AppPublisherURL=http://www.microsoft.com
AppSupportURL=http://www.microsoft.com
AppUpdatesURL=http://www.microsoft.com

From http://stackoverflow.com/a/349111/11421

Here's a nice and simple cache helper class/service I use:

using System.Runtime.Caching;  

public class InMemoryCache: ICacheService
{
 public T GetOrSet(string cacheKey, Func getItemCallback) where T : class
//from http://pastebin.com/jftEbWrc
public class LimitedPool<T> : IDisposable where T : class
{
readonly Func<T> _valueFactory;
readonly Action<T> _valueDisposeAction;
readonly TimeSpan _valueLifetime;
readonly ConcurrentStack<LimitedPoolItem<T>> _pool;
bool _disposed;
public LimitedPool(Func<T> valueFactory, Action<T> valueDisposeAction, TimeSpan? valueLifetime = null)
@mika76
mika76 / spy.cs
Last active September 11, 2016 07:29
rx spy
//from http://stackoverflow.com/questions/20220755/how-can-i-see-what-my-reactive-extensions-query-is-doing/20220756#20220756
public static IObservable<T> Spy<T>(this IObservable<T> source, string opName = null)
{
opName = opName ?? "IObservable";
Console.WriteLine("{0}: Observable obtained on Thread: {1}",
opName,
Thread.CurrentThread.ManagedThreadId);
return Observable.Create<T>(obs =>
@mika76
mika76 / RxTcpServer.cs
Created September 11, 2016 07:22 — forked from micahasmith/RxTcpServer.cs
rx c# tcp server
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Data;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using System.Reactive.Linq;
@mika76
mika76 / msbuild.xml
Last active June 24, 2016 06:01
Replacement for HeatDirectory since heat.exe throws a BadImageFormatException when running msbuild in 64 bit
<UsingTask
TaskName="CustomHeatDirectory"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" >
<ParameterGroup>
<Directory Required="true" />
<DirectoryRefId Required="true" />
<ComponentGroupName Required="true" />
<OutputFile Required="true" />
<GenerateGuidsNow Required="true" />