Skip to content

Instantly share code, notes, and snippets.

View codebeaulieu's full-sized avatar

Dan Beaulieu codebeaulieu

View GitHub Profile
@codebeaulieu
codebeaulieu / gist:a9972f95bbaf08e0bbfb
Created May 13, 2015 00:27
Stack Overflow Question: Is it possible to conditionally specify portrait or landscape mode?
//
// ViewController.swift
// Browser
//
// Created by Dan Beaulieu on 5/12/15.
// Copyright (c) 2015 Dan Beaulieu. All rights reserved.
//
import UIKit
import WebKit
@codebeaulieu
codebeaulieu / gist:d9a74b4414fdb18021ca
Created May 18, 2015 13:42
PostController.cs | programmers.stackexchange.com/posts/284164/edit | How do you handle saving blog tags in MVC?
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using BlogEngine.Models;
using BlogEngine.Database.Repositories;
@codebeaulieu
codebeaulieu / gist:8f3a94082469c2396180
Created May 18, 2015 13:44
Create.cshtml | programmers.stackexchange.com | How do you handle saving blog tags in MVC?
@model BlogEngine.Models.Post
@using BlogEngine.Models
@{
ViewBag.Title = "Create";
}
<div class="page-content">
<h2>Create</h2>
@codebeaulieu
codebeaulieu / gist:3ec0f8a5a36e4e5cacd0
Created May 19, 2015 02:46
Post.cs | Stack Overflow | How do I use OnModelCreating with ApplicationDbContext?
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Web;
namespace BlogEngine.Models
{
@codebeaulieu
codebeaulieu / gist:9327e9b3e4045c93ea20
Created May 19, 2015 02:48
Tag.cs | Stack Overflow | How do I use OnModelCreating with ApplicationDbContext?
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Web;
namespace BlogEngine.Models
{
@codebeaulieu
codebeaulieu / gist:bb4d90e9f47b1c1d9b6b
Created May 20, 2015 22:32
Post.cs | Stack Overflow | How to resolve ModelState.IsValid = false while binding a List type?
public class Post : IEntity
{
[Key]
public int Id { get; set; }
[Required]
public string Title { get; set; }
public string URL { get; set; }
[Required]
@codebeaulieu
codebeaulieu / gist:d812013030de19c6cdbe
Created May 20, 2015 22:33
Tag.cs | Stack Overflow | How to resolve ModelState.IsValid = false while binding a List type?
public class Tag : IEntity
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public List<Post> Posts { get; set; }
}
@codebeaulieu
codebeaulieu / gist:f0e63d6bb66c6c660929
Created May 20, 2015 22:35
Create.cshtml | Stack Overflow | How to resolve ModelState.IsValid = false while binding a List type?
@model BlogEngine.Models.Post
@using BlogEngine.Models
@{
ViewBag.Title = "Create";
Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml";
}
<div class="page-content">
<h2>Create</h2>
import UIKit
@objc protocol SideBarDelegate {
func sideBarDidSelectButtonAtIndex(index: Int)
optional func sideBarWillClose()
optional func sideBarWillOpen()
}
class SideBar: NSObject, SideBarTableViewControllerDelegate {
@codebeaulieu
codebeaulieu / gist:036fff790d50ab6e5b5b
Created June 11, 2015 23:41
SideBarTableViewController.swift
import UIKit
protocol SideBarTableViewControllerDelegate {
func sideBarControlDidSelectRow(indexPath: NSIndexPath)
}
class SideBarTableViewController: UITableViewController {
var delegate : SideBarTableViewControllerDelegate?