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 / 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 / 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 / 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 / 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 / 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 / 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 / Repository.cs
Last active March 22, 2022 11:08
Generic repository for EF
using OrangeMSE.Business;
using OrangeMSE.Business.Data;
using OrangeMSE.Business.Helpers;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Linq.Expressions;
@adrianvlupu
adrianvlupu / WebApiConfig.cs
Last active January 3, 2016 10:49
Common webapi config
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using Newtonsoft.Json;
using System.Web.Routing;
using System.Net.Http;
namespace WebRoleV2
{
@adrianvlupu
adrianvlupu / mvc.html
Created December 11, 2013 17:39
JS MVC
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="jquery-2.0.3.min.js"></script>
<script src="underscore.js"></script>
<script src="backbone.js"></script>
<script>
//#region eventHandler
var eventHandler = function (sender) {
function scan(obj, search, from)
{
var k;
if (obj instanceof Object) {
for (k in obj){
//console.log('object ', obj, k);
if (obj.hasOwnProperty(k)){
if(k.toString().indexOf(search)!=-1){
console.log('found string as prop ', k, obj);
}else{