Skip to content

Instantly share code, notes, and snippets.

View podkopaev's full-sized avatar

Denis Podkopaev podkopaev

View GitHub Profile
@podkopaev
podkopaev / Global.asax
Created March 5, 2015 14:40
Test Project
namespace MvcTest
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
dbContext db = new dbContext();
ControllerBuilder.Current.SetControllerFactory(new ControllerFactory(db));
RouteConfig.RegisterRoutes(DP.Web.Mvc.Core.RouteTable.Routes);
namespace DP.Web.Mvc.Authentication.Controllers
{
public class AuthenticationController : BaseController
{
public AuthenticationController(BaseDatabaseContext baseContext)
: base(baseContext)
{}
public ActionResult Index()
{
i have a user(id, name), interests(id, interest) and users_interests(user_id, interest_id) table.
how to select all users that have for example 2 matching interests.
lets say there are 4 users(mike, andre, julian, john). 2 of them have 3 matching interests.
for example mike(music, sports, games), andre(music, sports, games). the other 2 users have different interests.
i need a query where i can say give me all users with 2 matching interests. 2 is variable. the result would be mike and andre.
@podkopaev
podkopaev / gist:8632141
Last active January 4, 2016 14:08
Function returns an empty array.
portal.getHosterByStream = function (stream, callback) {
var content = "";
var items_hoster;
var $;
var rel = [];
var hoster = [];
async.series([
function (callback) {
console.log("2");
@podkopaev
podkopaev / gist:8406346
Created January 13, 2014 19:22
The problem is that this function returns an empty array. The array im talking about is hoster.
portal.getHosterByStream = function(stream, callback) {
request(URL + stream, function (error, response, body) {
if (!error && response.statusCode === 200) {
var hoster = [];
var $ = cheerio.load(body);
var information = $('body div[id=frmMain] div[id=dontbeevil] div[id=Vadda]').html();
var items_hoster = $(information).find("ul[id=HosterList]").html();
$(items_hoster).each(function (i, item) {
var rel = $(item).attr('rel');