Skip to content

Instantly share code, notes, and snippets.

View adrianvlupu's full-sized avatar
💾
the world

Victor Lupu adrianvlupu

💾
the world
  • Fullscreen Digital
  • Bucharest Romania
View GitHub Profile
@adrianvlupu
adrianvlupu / ConsoleTimer.cs
Last active August 29, 2015 13:59
A console app that executes code at a set interval
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OrangeMSE.Data;
using OrangeMSE.Connector;
using System.Threading;
using log4net;
@adrianvlupu
adrianvlupu / AccountController.cs
Created May 9, 2014 13:55
General account controller
using Newtonsoft.Json;
using OrangeMSE.Data;
using OrangeMSE.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
@adrianvlupu
adrianvlupu / numericSpinner.html
Last active August 29, 2015 14:02
Numeric Spinner Directive
<input id="{{id}}" type="text" name="" ng-model="value" />
<span class="add" ng-click="add()">+</span>
<span class="remove" ng-click="subtract()">-</span>
@adrianvlupu
adrianvlupu / datePicker.js
Last active August 29, 2015 14:02
Basic jquery plugin angular wrapper
/// <reference path="../../_references.js" />
//super adaptare de jquery plugin
mainModule.directive('datePicker', function () {
return {
restrict: 'A',
scope:{
bindModel: '=ngModel'
},
link: function ($scope, $elem, $attrs) {
@adrianvlupu
adrianvlupu / join.cs
Last active May 17, 2019 04:08
Left outer join in LINQ
void Main()
{
Dictionary<int, string> mere = new Dictionary<int, string>();
mere.Add(1, "rosii");
mere.Add(2, "verzi");
mere.Add(3, "albastre");
mere.Add(4, "galbene");
Dictionary<int, string> pere = new Dictionary<int, string>();
pere.Add(3, "albastre");
@adrianvlupu
adrianvlupu / recursive.sql
Last active August 29, 2015 14:03
TSQL recursive
DECLARE @id INT
SET @id = 7
DECLARE @tmp TABLE (id INT , ParentId INT)
INSERT INTO @tmp VALUES(1,0)
INSERT INTO @tmp VALUES(2,0)
INSERT INTO @tmp VALUES(3,2);
INSERT INTO @tmp VALUES(4,3);
INSERT INTO @tmp VALUES(5,0);
INSERT INTO @tmp VALUES(6,0);
@adrianvlupu
adrianvlupu / if.js
Last active March 31, 2019 13:40
if js joke
/*
************ Noul If ************
ofera multiple avantaje vs nativul if.
1. EstePascalCase
2. Are(callbackuri) la fel ca d3. Genial!
3. Accepta multiple Then/Else pentru a se mula pe orice proiect.
4. Colegii il vor adopta imediat !
Flexibil! Dinamic! Util! Deloc Ironic!
@adrianvlupu
adrianvlupu / SessionManager.cs
Created July 15, 2014 13:38
A session wrapper class
public class SessionManager
{
#region Instance
private SessionManager() { }
private const string SESSIONKEY = "SessionManager";
public static SessionManager Current
{
get
{
SessionManager instance = (SessionManager)HttpContext.Current.Session[SESSIONKEY];
@adrianvlupu
adrianvlupu / $d.js
Created July 23, 2014 09:46
deferred object js
var $d = (function () {
function $d() {
var self = this;
this._success = [];
this._fail = [];
this.promise = {
then: function (callback) {
self._success.push(callback);
},
@adrianvlupu
adrianvlupu / asyncModule.js
Last active October 1, 2015 08:28
async nodejs module
/**
* An async module
* @module asyncModule
*/
var q = require('q');
var debug = require('debug')('asyncModule');
debug.log = console.log.bind(console);
var service = (function () {
//private