Skip to content

Instantly share code, notes, and snippets.

View ajtowf's full-sized avatar

Ajden Towfeek ajtowf

View GitHub Profile
@ajtowf
ajtowf / sidenav.component.html
Last active October 17, 2020 10:52
Styling Applications with Angular Material - Removed Sidenav Docs Sample
<mat-sidenav-container class="example-container">
<mat-sidenav #sidenav class="example-sidenav">
Jolly good!
</mat-sidenav>
<div class="example-sidenav-content">
<button type="button" mat-button (click)="sidenav.open()">
Open sidenav
</button>
</div>
@ajtowf
ajtowf / db_context
Created February 20, 2015 14:30
EntityFramework Change Tracking
public class Db : DbContext
{
public Db() : base("Db")
{
Configuration.LazyLoadingEnabled = true;
}
public DbSet<Foo> Foos { get; set; }
public DbSet<Bar> Bars { get; set; }
}
@ajtowf
ajtowf / async_consume
Last active August 29, 2015 14:15
WcfAsyncProxyRefactor
var client = new ServiceClientAsync();
var data = await client.GetDataAsync(10);
var officeCacheDir = ConfigurationManager.AppSettings[OfficeCacheFolderKey];
var maxAgeMinutes = int.Parse(ConfigurationManager.AppSettings[LastAccessTimeMinutesBeforeDeleteKey]);
while (true)
{
string[] files = Directory.GetFiles(officeCacheDir).Where(file => Regex.IsMatch(file, @"^.+\.(FSD|FSF)$")).ToArray();
Console.WriteLine("Found {0} files", files.Length);
var deletedCount = 0;
foreach (string file in files)
{
@ajtowf
ajtowf / css
Created May 10, 2014 10:53
AngularJS ng-cloak example
.splash {
display: none;
}
[ng-cloak].splash {
display: block !important;
}
.splash {
position: absolute;
@ajtowf
ajtowf / EF Database.SetInitializer
Last active August 29, 2015 13:58
EF Code First
Database.SetInitializer(
new MigrateDatabaseToLatestVersion<AppDbContext, Configuration>());
@ajtowf
ajtowf / TeeHcp_no_nav
Created March 2, 2014 20:37
EF 5 -> 6 bug
public class TeeHcp
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore, IgnoreDataMember]
public int Id { get; set; }
public double From { get; set; }
public double To { get; set; }
public int Strokes { get; set; }
public interface IMetaWeblogClient
{
Task<Post> GetPostAsync(string postId);
Task<IEnumerable<Post>> GetRecentPostsAsync(int numberOfPosts);
}
Blog post - http://ajden.towfeek.se/post/become-your-own-root-certificate-authority-and-create-self-signed-ssl-certificates
.flex-video {
position: relative;
padding-top: 25px;
padding-bottom: 67.5%;
height: 0;
margin-bottom: 16px;
overflow: hidden;
}
.flex-video.widescreen { padding-bottom: 57.25%; }