Skip to content

Instantly share code, notes, and snippets.

@scottjehl
scottjehl / anchorinclude.js
Created May 20, 2011 17:04
Anchor-include Pattern
/*
* anchor-include pattern for already-functional links that work as a client-side include
* Copyright 2011, Scott Jehl, scottjehl.com
* Dual licensed under the MIT
* Idea from Scott Gonzalez
* to use, place attributes on an already-functional anchor pointing to content
* that should either replace, or insert before or after that anchor
* after the page has loaded
* Replace: <a href="..." data-replace="articles/latest/fragment">Latest Articles</a>
* Before: <a href="..." data-before="articles/latest/fragment">Latest Articles</a>
@insin
insin / index.html
Last active February 8, 2024 15:14
Export a <table> to Excel - http://bl.ocks.org/insin/1031969
<!DOCTYPE html>
<html>
<head>
<title>tableToExcel Demo</title>
<script src="tableToExcel.js"></script>
</head>
<body>
<h1>tableToExcel Demo</h1>
<p>Exporting the W3C Example Table</p>
@simme
simme / Install_tmux
Created October 19, 2011 07:55
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
@noniq
noniq / concat.rb
Created February 5, 2012 17:32
Script for building a single giant compass-all.scss file.
# Usage:
# ruby concat.rb /path-to-compass-gem/frameworks/compass/stylesheets/_compass.scss > compass-all.scss
@seen = []
def concat(file)
File.foreach(file) do |line|
if line =~ /^\s?@import "(.+?)";/
import = $1
unless @seen.include?(import)
@scottjehl
scottjehl / getViewportSize.js
Created March 16, 2012 19:25
Reliably get viewport dimensions in JS
/*!
An experiment in getting accurate visible viewport dimensions across devices
(c) 2012 Scott Jehl.
MIT/GPLv2 Licence
*/
function viewportSize(){
var test = document.createElement( "div" );
test.style.cssText = "position: fixed;top: 0;left: 0;bottom: 0;right: 0;";
@karlhorky
karlhorky / grayscale-disable.css
Created August 26, 2012 12:17
Cross-Browser CSS Grayscale
img.grayscale.disabled {
filter: url("data:image/svg+xml;utf8,&lt;svg xmlns=\'http://www.w3.org/2000/svg\'&gt;&lt;filter id=\'grayscale\'&gt;&lt;feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/&gt;&lt;/filter&gt;&lt;/svg&gt;#grayscale");
-webkit-filter: grayscale(0%);
}
@hannestyden
hannestyden / gist:3897757
Created October 16, 2012 07:24
OS X 10.8 Mountain Lion: Remove Notification Center and Spotlight from menu bar.
# [Notification Center](http://osxdaily.com/2012/08/06/disable-notification-center-remove-menu-bar-icon-os-x/)
## Disable
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
killall NotificationCenter # optional?
## Enable
launchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
# Spotlight
@JeffreyWay
JeffreyWay / tip.sh
Created August 15, 2013 17:51
Ever want to undo everything that you've worked on since the last commit (including adding new files)? Here's a little alias to help with that.
alias gundo='git reset HEAD~ && git clean -df'
@gvn
gvn / code-smell.md
Last active June 16, 2021 09:02
Eliminating Code Smell With Grunt

Eliminating Code Smell With Grunt

by Gavin Lazar Suntop @gvn

Intro

I love clean code. There, I said it. I pride myself on passing strict linting standards and keeping my code easy to read. It's not just a personal proclivity, but a choice I hope benefits other developers.

My general experience with teams has been that code style is something people care about and have strong personal preferences. Typically, at some point people get tired of dealing with inconsistency and a standardization meeting is called. This is, of course, an important discussion to have. The problem that tends to occur is either lack of documentation or lack of enforcement of the agreed upon style. Additionally, new team members or contributors may not have access to a clear set of rules.

@Andrew-Max
Andrew-Max / gist:305483febc3c367dbf57
Last active June 13, 2022 07:55
Route lifecycle hooks guide from Ember meetup lightning talk
App.LibraryRoute = App.ApplicationRoute.extend({
activate: function () {
//no longer enter
this._super();
only called once on entering a route.
},
beforeModel: function () {
// any state you want in place before the model is initialized, this is called before any model promises are resolved
// also could be used to conditionally prevent access to a route by throwing transition.abort