Skip to content

Instantly share code, notes, and snippets.

@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@paulirish
paulirish / rAF.js
Last active April 17, 2025 15:06
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@mbostock
mbostock / .block
Last active February 8, 2025 06:32
Mitchell’s Best-Candidate
license: gpl-3.0
redirect: https://observablehq.com/@mbostock/best-candidate-circles
@florisrobbemont
florisrobbemont / DbSeederMigrator.cs
Created August 4, 2012 15:27
EF: Bundle Seed code with Migration classes for seeding per migration
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Text.RegularExpressions;
/// <summary>
/// Provides advanced migrations by providing a seeding platform for each migration.
@McNull
McNull / Binder.cs
Created November 27, 2012 18:29
Json Model Binding with Knockout and ASP.NET MVC
namespace System.Web.Mvc {
public class JsonModelBinder : IModelBinder {
private readonly static System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) {
var stringified = controllerContext.HttpContext.Request[bindingContext.ModelName];
if (string.IsNullOrEmpty(stringified))
return null;
return serializer.Deserialize(stringified, bindingContext.ModelType);
}
@josheinstein
josheinstein / MyDbContext.cs
Created April 16, 2014 20:07
When using Entity Framework code-first with LINQPad (or any time an EF DbContext is subclassed) any calls to Database.SetInitializer with the base class is effectively ignored. This is especially irritating with LINQPad which needs to subclass the context class in order to work the way it is designed. This means that if you called Database.SetIn…
public class MyDbContext : DbContext
{
/// <summary>
/// Initializes a new instance of the <see cref=“T:MyDbContext"/> class.
/// </summary>
public MyDbContext( )
: base( "DefaultConnection" )
{
@grifdail
grifdail / gulpfile.js
Last active June 5, 2018 13:35
Simple babel livereload
var gulp = require('gulp'),
babel = require('gulp-babel'),
livereload = require('gulp-livereload'),
http = require('http'),
st = require('st'),
transform = require('vinyl-transform'),
browserify = require('browserify');
gulp.task('js', ["es6"],function() {
// LoadingScreenManager
// --------------------------------
// built by Martin Nerurkar (http://www.martin.nerurkar.de)
// for Nowhere Prophet (http://www.noprophet.com)
//
// Licensed under GNU General Public License v3.0
// http://www.gnu.org/licenses/gpl-3.0.txt
using UnityEngine;
using UnityEngine.UI;
@rdavisau
rdavisau / dark-style-from-vs-2015.json
Created February 25, 2016 04:26
dark-style-from-vs-2015.json
{
"name":"dark-style-from-vs-2015",
"version":"1.0",
"description":"Imported color scheme",
"originator":"Imported from /Users/rdavis/Library/XamarinStudio-5.0/HighlightingSchemes/dark-style-from-vs-2015.vssettings",
"colors":[
{"name": "Background(Read Only)", "color":"#1E1E1E" },
{"name": "Search result background", "color":"#005F60" },
{"name": "Search result background (highlighted)", "color":"#007F80" },
{"name": "Fold Square", "color":"#A5A5A5" },
@Split82
Split82 / UnityShadersCheatSheet.shader
Created April 17, 2018 10:07
Unity Shaders Cheat Sheet
Shader "Name" {
Properties {
_Name ("display name", Range (min, max)) = number
_Name ("display name", Float) = number
_Name ("display name", Int) = number
_Name ("display name", Color) = (number,number,number,number)
_Name ("display name", Vector) = (number,number,number,number)