This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
var monkey = Object.create(Object.prototype, | |
{ | |
name: { | |
value: "Hansel", | |
writable: true, | |
enumerable: true, | |
configurable: true | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JavaScript object is a collection of properties | |
var cat = { name: 'Felix', color:'blue' } | |
// We can get descriptor infomation out, descriptors returns: | |
// Object {value: "phil", writable: true, enumerable: true, configurable: true} | |
var descriptors = Object. getOwnPropertyDescriptor(cat, 'name') | |
// We can change the properties of an object using defineProperty: | |
Object.defineProperty(cat, ‘name’, {writable: false}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cat = { name: 'Felix', color:'blue' } | |
// We can view the properties in the object by simply looping through: | |
for(var property in cat) { | |
document.write(key + ": " + cat[property] + ";"); // name: Felix; color:blue; | |
} | |
// Now we set enumerable to false | |
Object.defineProperty(cat, ‘name’, {ennumerable: false}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="inputControl"> | |
<input id="FollowUp" name="FollowUp" type="checkbox" value="true" /> | |
<input name="FollowUp" type="hidden" value="false" /> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To disable and clear the checkbox, use "prop" NOT "attr" | |
$("#FollowUp").prop("disabled", checked); | |
$("#FollowUp").prop("checked", false); | |
// Options for setting values | |
checkbox.val("disabled", false); // Sets the value, but not if it is checked | |
checkbox.prop("disabled", false); // Disables the checkbox | |
checkbox.attr("disabled", false); // Also disables depending on version | |
checkbox.is(":checked"); // Returns checked value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UserManager : UserManager<User> | |
{ | |
public UserManager(IUserStore<User> store) | |
: base(store) | |
{ | |
} | |
// This method is called by Owin therefore best place to configure your User Manager | |
public static UserManager Create( | |
IdentityFactoryOptions<UserManager> options, IOwinContext context) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User : IdentityUser | |
{ | |
} | |
public class Role : IdentityRole | |
{ | |
public Role() : base() { } | |
public Role(string name) : base(name) { } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TimesheetsContext : IdentityDbContext<User> , ITimesheetsContext | |
{ | |
public IDbSet<Employee> Employees { get; set; } | |
public IDbSet<Department> Departments { get; set; } | |
public IDbSet<TimeCode> TimeCodes { get; set; } | |
public IDbSet<Timesheet> Timesheets { get; set; } | |
public TimesheetsContext() | |
: base("TimesheetsContext") | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IdentityConfig | |
{ | |
public void Configuration(IAppBuilder app) | |
{ | |
app.CreatePerOwinContext(() => new TimesheetsContext()); | |
app.CreatePerOwinContext<UserManager>(UserManager.Create); | |
app.CreatePerOwinContext<RoleManager<Role>>((options, context) => | |
new RoleManager<Role>( | |
new RoleStore<Role>(context.Get<TimesheetsContext>()))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tail (){ | |
Param( | |
[string] $file, | |
[int] $last = 10 | |
) | |
Get-Content $file | Select-Object -Last $last | |
} |