Skip to content

Instantly share code, notes, and snippets.

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

Mladen Mihajlović mika76

🤖
Coding...
  • Serbia
  • 07:02 (UTC +02:00)
View GitHub Profile
//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)

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
; 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
@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
{
@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 / 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 / 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 / colors.lua
Created May 14, 2018 06:21 — forked from Lerg/colors.lua
147 color names as a Lua table, RGB from 0 to 1.
return {
aliceblue = {0.94117647058824, 0.97254901960784, 1},
antiquewhite = {0.98039215686275, 0.92156862745098, 0.84313725490196},
aqua = {0, 1, 1},
aquamarine = {0.49803921568627, 1, 0.83137254901961},
azure = {0.94117647058824, 1, 1},
beige = {0.96078431372549, 0.96078431372549, 0.86274509803922},
bisque = {1, 0.89411764705882, 0.76862745098039},
black = {0, 0, 0},
blanchedalmond = {1, 0.92156862745098, 0.80392156862745},
@mika76
mika76 / Perspective
Created May 22, 2018 21:49
Perspective Virtual Camera System
Perspective Virtual Camera System
Licensed under the MIT license, which basically means you can do anything you want with it.
@mika76
mika76 / colormatrix.lua
Created May 27, 2018 11:45 — forked from anonymous/colormatrix.lua
Color Transition Matrix
--Created by Tanner Gower (triggdev)
local colormatrix = {}
local function getBackgroundColorMatrix(colors, pw, pt)
local matrix = {}
local t = 0
local d = 0
for i = 1, 3, 1 do