Skip to content

Instantly share code, notes, and snippets.

@necolas
necolas / README.md
Last active March 28, 2024 20:34
Experimenting with component-based HTML/CSS naming and patterns

NOTE I now use the conventions detailed in the SUIT framework

Template Components

Used to provide structural templates.

Pattern

t-template-name
@jpoehls
jpoehls / BaseController.cs
Created December 2, 2011 19:38
Newtonsoft Json Results for MVC
using System;
using System.Linq;
using System.Web.Mvc;
public abstract class BaseController : Controller
{
protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding)
{
return new JsonNetResult
{
@dmethvin
dmethvin / gist:1676346
Created January 25, 2012 13:51
Breakpoint on access to a property
function debugAccess(obj, prop, debugGet){
var origValue = obj[prop];
Object.defineProperty(obj, prop, {
get: function () {
if ( debugGet )
debugger;
return origValue;
},
@tqheel
tqheel / commit-config.sh
Created July 19, 2012 16:09
Prevent ASP.Net Web.Config From Being Committed By Git
#Run this to reverse ignoring of changes to web.config so it gets committed.
git update-index --no-assume-unchanged path_to_file/web.config
@getify
getify / 1.md
Last active November 24, 2016 04:29
fiddling around with a grips-css syntax (very LESS-like)

grips-css

Overview

LESS/SASS/Compass style CSS pre-processing is basically the same set of techniques as HTML templating. So, instead of having two different tools that do basically the same thing (text templating), grips has a pre-processor for CSS*-like syntax which allows you to use the same CSS pre-processing techniques you're already familiar with, to do your CSS generation via the grips templating engine.

This gist shows off a LESS-like syntax for CSS in the grips engine whereby you can get most of the major benefits (variables, mixins, nesting, etc).

NOTE: Just like with LESS, gcss is a superset of normal CSS, which means that you could compile a standard CSS file with grips-css, and it just wouldn't have any of the dynamic features.

@addyosmani
addyosmani / headless.md
Last active May 17, 2024 03:38
So, you want to run Chrome headless.

Update May 2017

Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

@rustd
rustd / ASP.NET Identity & Security.md
Last active August 29, 2015 13:57
Information about ASP.NET Identity & Security

In Visual Studio 2013 we revamped the membership and authentication system for ASP.NET web developers.

We added ASP.NET Identity which is a modern membership system for ASP.NET applications. It includes features such as Two-Factor Authentication which is becoming a common practise for securing web applications. For more information on why did we create ASP.NET Identity please read http://www.asp.net/identity/overview/getting-started/introduction-to-aspnet-identity

As part of Microsoft OWIN Components (Katana) We also added support for OWIN and added OWIN middlewares such as OWIN Cookies (and more) which replaces the FormsAuthentication module. The move to be OWIN compliant Framework will allow us to build apps which are more flexible, portable, lightweight, and provide better performance. For more information please read http://www.asp.net/aspnet/overview/owin-and-katana/an-overview-of-project-katana

We are in the processing of adding documentation for these changes but we

@NickCraver
NickCraver / StringSplits.cs
Last active June 19, 2019 20:26
StringSplits is a helper class thought up by Marc Gravell we use in the Stack Overflow/Stack Exchange code base to save on string allocations and relieve the garbage collector on gen 0.
/// <summary>
/// Using a single instance of these arrays prevents an allocation of a new array on every call to something like
/// string.Split(';') which is really calling string string.Split(params char[] separator), causing an allocation
/// of an additional array behind the scenes.
/// </summary>
/// <remarks>
/// For most applications this is a micro-optimization that doesn't matter. However, for very high traffic code paths
/// this can generate a significant amount of items that the gen 0 garbage collector needs to collect, causing micro-stalls
/// in the app domain when it runs, or runs more often.
/// </remarks>
@staltz
staltz / introrx.md
Last active July 6, 2024 17:07
The introduction to Reactive Programming you've been missing
@garris
garris / TremulaJS-Boilerplate.markdown
Last active December 12, 2015 13:57
A Pen by Garris.

TremulaJS Boilerplate

TremulaJS is a client-side javascript UI component providing Bézier-based content-stream interactions with momentum & physics effects for mouse, scroll and and touch UIs.

This Pen allows you to experiment using different config file settings.

A Pen by Garris on CodePen.

License.