Skip to content

Instantly share code, notes, and snippets.

@Lobstrosity
Lobstrosity / SassMeister-input.scss
Created December 7, 2013 05:29
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
/* Modular syntax using the 3.3 at-root syntax. */
.Component {
border: 1px;
@at-root #{&}-child {
String.prototype.commafy = function () {
return this.replace(
/^(-?\d+)(\d{3}(\.\d+)?)$/,
function (_, a, b) {
return a.commafy() + ',' + b;
}
);
};
@Lobstrosity
Lobstrosity / OurContext.cs
Created January 15, 2012 05:51
initialize DbContext with custom connection string
public class OurContext : DbContext
{
public string ClientKey { get; private set; }
/// We make use of the DbContext constructor overload that accepts a
/// connection string to connect to.
public OurContext(string clientKey)
: base(GetClientConnectionString(clientKey))
{
@Lobstrosity
Lobstrosity / gist.js
Created August 18, 2011 04:04
Gist Embeds Redux
var gistPrefix = 'http://gist.github.com/',
fileAnchorPrefix = '#file_',
// Cache document.write so that it can be restored once all Gists have been
// embedded.
cachedWrite = document.write,
body = $('body'),
@media screen and (min-width: 960px) { }
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Templates</title>
</head>
<body>
<div class="greeting"></div>
<script class="greeting" type="text/x-jquery-tmpl">
@Lobstrosity
Lobstrosity / 1.jqueryTemplates.html
Created August 10, 2011 02:28
jQuery Templates Plugin
<script type="text/x-jquery-tmpl">
{{each items}}
<li>${$value}</li>
{{/each}}
<!-- is equivalent to -->
{{each(i, item) items}}
<li>${item}</li>
{{/each}}
@Lobstrosity
Lobstrosity / 1.cssMediaQueries.html
Created August 10, 2011 00:58
CSS Media Queries
<head>
<link rel="stylesheet" href="base.css" />
<link rel="stylesheet" href="mobile.css" media="max-width: 320px" />
<!-- OR -->
<style type="text/css">
/* base styles go here */
@media (max-width: 320px)
@Lobstrosity
Lobstrosity / 1.jqueryPluginPattern.js
Created August 10, 2011 00:35
jQuery Plugin Pattern
(function($) {
$.fn.enable = function() {
// Enable each selected element by removing its 'disabled' attribute.
return this.each(function() {
$(this).removeAttr('disabled');
});
};
$.fn.disable = function() {
@Lobstrosity
Lobstrosity / 1.scope.js
Created August 10, 2011 00:19
JavaScript Module Pattern
var message = 'Hello!';
(function() {
var message = 'Hi!';
alert(message);
})();