Skip to content

Instantly share code, notes, and snippets.

View nzhul's full-sized avatar
Power Overwhelming!

Dobromir Ivanov nzhul

Power Overwhelming!
View GitHub Profile
@nzhul
nzhul / UsingAutomapper.cs
Last active August 29, 2015 14:25
This is an simple example of how one can use AutoMapper Library
using Models;
using System.Collections.Generic;
using System.Linq;
using AutoMapper;
namespace Data
{
public class UsersService
{
public ICollection<User> Users { get; set; }
--------------------------- THE MODEL --------------------------------------
public class DatePickerInputModel
{
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}", ApplyFormatInEditMode = true)]
public DateTime Date { get; set; }
}
------------------------------ APP START CONFIGURATION ----------------
Removing all deleted files: git ls-files --deleted -z | xargs -0 git rm
Removing deleted directory:
git rm -r --cached App/App.Web/DirectoryName
git commit -m 'Remove the now ignored directory "some-directory"'
git push
@nzhul
nzhul / CellularAutomata.cs
Last active November 11, 2015 12:31
Cellular automata - procedural cave generation
using System;
namespace CellularAutomata
{
class Program
{
static void Main(string[] args)
{
char key = new char();
MapHandler Map = new MapHandler();
@nzhul
nzhul / LayersToPNG.jsx
Created January 26, 2016 23:09
Spine 2D - LayersToPNG.jsx fix for Photoshop CC
// This script exports photoshop layers as individual PNGs. It also
// writes a JSON file that can be imported into Spine where the images
// will be displayed in the same positions and draw order.
// Setting defaults.
var writePngs = true;
var writeTemplate = false;
var writeJson = true;
var ignoreHiddenLayers = true;
var pngScale = 1;
using System;
using System.Net;
using System.Text;
using System.Threading;
namespace WebPageWatcher
{
public class Program
{
public static State state;
@nzhul
nzhul / Unity3DEventManager.cs
Created July 5, 2016 15:40
Pseudo code for Unity3d EventManager. Basically this is implementation of Observer pattern but with some twists for Unity3d
using System;
using System.Collections.Generic;
namespace EventManager
{
public class EventManager
{
private static EventManager instance = null;
public static EventManager Instance
{
@nzhul
nzhul / WebSocketsWithFleck.cs
Last active March 23, 2022 04:35
Example of simple WebSockets server using Fleck
// Javascript example
$(function(){
var webSocket = window.WebSocket || window.MozWebSocket,
ws = new webSocket('ws://localhost:8181');
ws.onopen = function(e){
console.log('Connection opened');
}
@nzhul
nzhul / deleteBinariesFolders.ps1
Created November 8, 2016 07:54
Powershell script that can be used to delete all binary files recursively
param (
[string]$path = $(Read-Host "Path to folder")
)
$foldersToDelete = Get-ChildItem -Path $path -Recurse -Name "bin" -Directory | %{ Join-Path -Path $path -ChildPath $_.ToString() }
Remove-Item $foldersToDelete -Recurse -Confirm:$false
#Write-Host $foldersToDelete
------------- GenerateForumsSpamProtectionNuGetPackages.ps1 ---------------
[CmdletBinding()]
Param(
[alias("sln")]
$slnName = "Web.SitefinityModules.PublishingExtender",
[alias("slnDir")]
$slnDirectory = $null,
[alias("outDir")]
$outputDir = "C:\LEAN\local-nuget-repository",
[alias("projects")]