Skip to content

Instantly share code, notes, and snippets.

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

Mladen Mihajlović mika76

🤖
Coding...
  • Serbia
  • 05:28 (UTC +02:00)
View GitHub Profile
@brandontreb
brandontreb / Vector2D.lua
Created June 3, 2011 14:26
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)
@jcsrb
jcsrb / gist:1081548
Created July 13, 2011 23:05
get avatar from google profiles, facebook, gravatar, twitter, tumblr
function get_avatar_from_service(service, userid, size) {
// this return the url that redirects to the according user image/avatar/profile picture
// implemented services: google profiles, facebook, gravatar, twitter, tumblr, default fallback
// for google use get_avatar_from_service('google', profile-name or user-id , size-in-px )
// for facebook use get_avatar_from_service('facebook', vanity url or user-id , size-in-px or size-as-word )
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px )
// for twitter use get_avatar_from_service('twitter', username, size-in-px or size-as-word )
// for tumblr use get_avatar_from_service('tumblr', blog-url, size-in-px )
// everything else will go to the fallback
// google and gravatar scale the avatar to any site, others will guided to the next best version
@SteveDunn
SteveDunn / EnumMapper.cs
Created August 17, 2011 21:25
Enum Mapper in C#
public class EnumMapper : IDisposable
{
readonly Dictionary<Type, Dictionary<string, object>> _stringsToEnums =
new Dictionary<Type, Dictionary<string, object>>( ) ;
readonly Dictionary<Type, Dictionary<int, string>> _enumNumbersToStrings =
new Dictionary<Type, Dictionary<int, string>>( ) ;
readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim( ) ;
@drstevens
drstevens / gist:1409829
Created November 30, 2011 17:05
Globally handle fatal exceptions in Rx.Net subscribers
/* This is how I am globally handling fatal exceptions thrown from Rx subscribers.
* It is what I came up with in response to my stackoverflow question here
* http://stackoverflow.com/questions/7210051/catching-exceptions-which-may-be-thrown-from-a-subscription-onnext-action
* This is far from ideal. From what I understand, exception handling has been improved greately in Rx for .NET 4.5
*/
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@micahasmith
micahasmith / RxTcpServer.cs
Created May 7, 2012 03:19
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;
@TaoK
TaoK / Diff.cs
Created May 8, 2012 08:01
C# port of JS 3-way merge implementation in Synchrotron
// Copyright (c) 2006, 2008 Tony Garnock-Jones <tonyg@lshift.net>
// Copyright (c) 2006, 2008 LShift Ltd. <query@lshift.net>
//
// 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:
@AngryAnt
AngryAnt / EditorWindowExample.cs
Created June 15, 2012 08:30
EditorWindowExample from the Unity Asia Bootcamp 12 talk "Streamlining your Unity editor". A simple node based editor.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class EditorWindowExample : EditorWindow
{
List<Node> nodes = new List<Node> ();
@gereon
gereon / gist:3150445
Created July 20, 2012 12:20
Mac OSX Spotlight Enhancement

Mac OSX Spotlight Enhancement

Add this to Info.plist in /System/Library/Spotlight/RichText.mdimporter/Contents/ and Spotlight will search for source code files.

<string>public.c-header</string>
<string>public.c-plus-plus-header</string>
<string>public.c-source</string>
<string>public.objective-c-source</string>
public.c-plus-plus-source
@nickalbrecht
nickalbrecht / SelectListExtensionMethods.cs
Last active November 5, 2022 19:57
SelectListItem Extension Methods for DropDowns in MVC Core. Added ability to specify the option's Group, and for some bug fixes, more XML docs
public static class SelectListExtensionMethods
{
/// <summary>
/// The SelectListItem to use by default as the placeholder for select lists generated by these extension methods when the user needs to pick a value.
/// </summary>
public static readonly SelectListItem DefaultEmptySelectListItem = new SelectListItem() { Text = "-- Pick One --", Value = string.Empty };
/// <summary>
/// The SelectListItem to use by default as the placeholder for select lists generated by these extension methods when not picking a value is the same as using as of the possible choices (meant for filtering typically)
/// </summary>
public static readonly SelectListItem AnySelectListItem = new SelectListItem() { Text = "-- Any --", Value = string.Empty };
@evanlarsen
evanlarsen / transitionHelper.js
Last active February 8, 2021 17:12
Durandal transition helper file. This imposes that you are using https://github.com/daneden/animate.css Also, that you have changed the animation duration in animate.css from 1s to .3s
define(function(require) {
var system = require('../system');
var animationTypes = [
'bounce',
'bounceIn',
'bounceInDown',
'bounceInLeft',
'bounceInRight',
'bounceInUp',