Skip to content

Instantly share code, notes, and snippets.

View dougludlow's full-sized avatar
🏠
Working from home

Douglas Ludlow dougludlow

🏠
Working from home
  • Swell
  • Spanish Fork, UT
  • 05:52 (UTC -06:00)
View GitHub Profile
@carols10cents
carols10cents / ajax_settings.coffee
Last active April 11, 2019 16:35
One way to get Rails and Backbone CSRF protection working
# In your Backbone app, wherever you want -- we put this in lib/ajax_settings.coffee
define [
'backbone',
'cookie' # This is https://github.com/js-coder/cookie.js,
# we have a bower-compatible fork at https://github.com/thinkthroughmath/cookie.js
], (Backbone, cookie) ->
init: ->
# This overrides all ajax requests sent through Backbone. We could have set this in jQuery
# since Backbone ultimately calls the jQuery ajax functions, but we decided we shouldn't be
# doing ajax requests outside of Backbone anyway.
@tommaitland
tommaitland / ng-debounce.js
Last active November 9, 2018 02:17
Debounce/Throttling Directive for Angular JS 1.2+
angular.module('app', []).directive('ngDebounce', function($timeout) {
return {
restrict: 'A',
require: 'ngModel',
priority: 99,
link: function(scope, elm, attr, ngModelCtrl) {
if (attr.type === 'radio' || attr.type === 'checkbox') return;
elm.unbind('input');
@mbest
mbest / mbest-knockout-isotope.js
Last active June 30, 2016 15:54
Isotope binding for Knockout, using "arrayChange" feature of Knockout 3.0. Example: http://jsfiddle.net/mbest/ACSGx/
/*
Isotope binding for Knockout 3+
(c) Michael Best
License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
"use strict";
ko.bindingHandlers.isotope = {
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active April 20, 2025 17:02
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@shawndumas
shawndumas / .gitconfig
Created August 5, 2013 19:08
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@jkarsrud
jkarsrud / BundleInstall.md
Last active May 27, 2020 08:51
How to use ASP.NET Bundling and Minifications in Umbraco

How to use ASP.NET Bundling and Minifications in Umbraco

Using the ASP.NET bundling and minifications is pretty straight forward, but here is a small guide that take care of a few gotchas when implementing bundles in your Umbraco project.

Installing ASP.NET Bundling and Minifications

ASP.NET Bundling and Minifications is part of the Microsoft ASP.NET Web Optimization Framework and is installed via NuGet;

PM> Install-Package Microsoft.AspNet.Web.Optimization

Once this is done, you need to create a BundleConfig.cs in your App_Start1 folder. This is where you register your different bundles. It can be extremely simple, or it can be more complex, but the gist of it is this;

Delete remote merged into master
git branch -r --merged | awk -F'/' '/^ *origin/{if(!match($0, /(>|master)/)){print $2}}' | xargs git push origin --delete
Delete local merged into current branch
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
Delete all remote not in egrep
git branch -a | egrep "remotes/origin/" | cut -d "/" -f 3- | egrep -v "(master|develop)" | xargs -n 1 git push --delete origin
@cobyism
cobyism / gh-pages-deploy.md
Last active April 12, 2025 09:10
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 28, 2025 00:02
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@kevinblake
kevinblake / gist:4000628
Created November 2, 2012 11:50
Rebuild Examine Indexes on Application Start
using System.Collections.Generic;
using Examine;
using umbraco.businesslogic;
namespace MyApplication
{
public class ExamineIndexRebuild : ApplicationStartupHandler
{