Skip to content

Instantly share code, notes, and snippets.

@KyleGobel
KyleGobel / 0_reuse_code.js
Created October 4, 2013 13:04
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@KyleGobel
KyleGobel / icons.css
Created October 10, 2013 18:14
Search Icon
.icon-searchglass {
font-family: 'deersoIcons';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
}
@KyleGobel
KyleGobel / CategoryFullPathRepository.cs
Created October 14, 2013 20:03
View From Entity Framework
public class CategoryFullPathRepository : ICategoryFullPathRepository
{
protected DbContext DbContext { get; set; }
public CategoryFullPathRepository(DbContext dbContext)
{
DbContext = dbContext;
}
public IEnumerable<CategoryFullPath> GetAllPaths()
{
return DbContext.Database.SqlQuery<CategoryFullPath>("SELECT * FROM [Main].[Catalog].[vCategoryFullPath]");
namespace Deerso.Domain.Models
{
public class CategoryFullPath
{
public CategoryFullPath()
{
}
public int Id { get; set; }
public string Name { get; set; }
@KyleGobel
KyleGobel / AccountController.cs
Created October 16, 2013 11:06
Account Controller for EZCP
public class AccountController : Controller
{
public IFormsAuthenticationService FormsService { get; set; }
public IMembershipService MembershipService { get; set; }
protected override void Initialize(RequestContext requestContext)
{
if (FormsService == null) { FormsService = new FormsAuthenticationService(); }
if (MembershipService == null) { MembershipService = new AccountMembershipService(); }
@KyleGobel
KyleGobel / gradient.scss
Created October 16, 2013 19:37
Gradient SASS Mixin
@mixin gradient($from, $to) {
/* fallback/image non-cover color */
background-color: $from;
/* Firefox 3.6+ */
background-image: -moz-linear-gradient($from, $to);
/* Safari 4+, Chrome 1+ */
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from($from), to($to));
(function($) {
$.fn.nodoubletapzoom = function() {
$(this).bind('touchstart', function preventZoom(e) {
var t2 = e.timeStamp
, t1 = $(this).data('lastTouch') || t2
, dt = t2 - t1
, fingers = e.originalEvent.touches.length;
$(this).data('lastTouch', t2);
if (!dt || dt > 500 || fingers > 1) return; // not double-tap
@KyleGobel
KyleGobel / ConvertExample.cs
Created November 20, 2013 20:12
Convert Types of an Expression
class Foo {
public int Value { get; set; }
}
class Bar {
public int Value { get; set; }
}
static class Program {
static void Main() {
Expression<Func<Foo, bool>> predicate =
x => x.Value % 2 == 0;
@KyleGobel
KyleGobel / RestSharpRX.cs
Created November 22, 2013 02:29
Use RestSharp with ReactiveExtensions and Reactive UI
private IObservable<List<Client>> GetClients()
{
var request = new RestRequest("client/", Method.GET);
var subject = new AsyncSubject<List<Client>>();
_restClient.ExecuteAsync<ClientResponseDTO>(request, response =>
{
subject.OnNext(response.Data.Entities);
subject.OnCompleted();
});
var self = this;
var uglyVm = {
object1 : ko.observable("hello there"),
object2 : ko.observable(new (function () {
var self = this;
self.subObject1 = ko.observable("goodbye now");
})(self))
};