Skip to content

Instantly share code, notes, and snippets.

View slindberg's full-sized avatar
💭
I'm a mechanical engineer now

Steven Lindberg slindberg

💭
I'm a mechanical engineer now
View GitHub Profile
@slindberg
slindberg / .gitconfig
Created October 6, 2010 23:55
Git config file
[core]
# global gitignore
excludesfile = /path/to/global/.gitignore
# this is the default, but make sure anyway :)
editor = /usr/bin/vim
# make pager use tabstops of 4 spaces instead of 8 (also don't wrap lines)
pager = /usr/bin/less -S -x4
[user]
# information about you that will appear in commit history
name = <Your Display Name>
@slindberg
slindberg / .vimrc
Created January 20, 2011 19:24
Vim config file
set ls=2 " allways show status line
set number " show line numbers
set ruler " show line current line number/column
set showmatch " show matching brackets/braces/parantheses
set showcmd " display incomplete commands
set ttyfast " smoother changes
set tabstop=2 " numbers of spaces of tab character
set shiftwidth=2 " numbers of spaces to (auto)indent
set autoindent " auto indentation
set expandtab " use spaces instead of evil tabs
@slindberg
slindberg / .bash_profile
Created January 20, 2011 19:27
Super-basic bash profile
# everything is in .bashrc
source ~/.bashrc
# personal bin folder trumps all
if [ -d ~/.bin ]; then
export PATH=:~/.bin:$PATH
fi
@slindberg
slindberg / .bashrc
Created January 20, 2011 19:28
Custom bash config (somewhat OS X specific)
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# run Homebrew profile scripts
for script in /usr/local/etc/profile.d/*.sh; do
if [ -r $script ]; then
. $script
fi
done
@slindberg
slindberg / pre-commit.sh
Created May 27, 2011 20:52
Git Pre-commit Hook
#!/bin/sh
#
# Pre-commit Hook
#
# Searches for black-listed strings in the commit and exits with an
# error if found, printing a diff of the location of the offending string
#
STATUS=0;
BLACKLIST="error_log
@slindberg
slindberg / convert_charset
Created September 26, 2012 19:42
Bash script for converting the charset of all tables in a database
#!/bin/bash
# Convert all tables in a specified database to a different charset
#
# NOTE: this will NOT preserve data if it was stored improperly to begin with,
# e.g. UTF8 encoded strings saved as latin1 charset will get munged by this
# script when the table is converted. To preserve data you must export it, change
# the charset, then re-import.
#
# Command taken from:
@slindberg
slindberg / index.html
Last active December 11, 2015 03:08 — forked from iffy/index.html
Custom path interpolator
<html>
<head>
<title>Chart</title>
<style>
path {
stroke: #f00;
}
.line {
stroke: #0f0;
fill: none;
@slindberg
slindberg / adapter.js
Last active December 24, 2015 14:59
Ember data serializer that normalizes embedded records without ids
App.ApplicationSerializer = DS.RESTSerializer.extend({
// Extract embedded relations from the payload and load them into the store
normalizeRelationships: function(type, hash) {
var store = this.store;
this._super(type, hash);
type.eachRelationship(function(attr, relationship) {
var relatedTypeKey = relationship.type.typeKey;
@slindberg
slindberg / README.md
Last active July 27, 2022 09:22
Ember debug helpers intended to be used in the JavaScript console

Ember.Console

This is a set of helpers for finding the application's currently active models/routes/controllers/etc. This isn't a straightforward process because of how Ember (rightly) encapsulates application objects, but it's useful in debugging environments to be able to quickly access them. And with the beta release of Ember Data, the store is not easily accessible without helpers either.

Usage

All helpers can be called directly if you provide them an application instance:

@slindberg
slindberg / multi-select-input.hbs
Created January 23, 2014 22:05
Ember Components: Overridable Content Blocks Example
{{#content-for "option"}}
<a href="#">{{view.label}}</a>
{{/content-for}}
{{#content-for "unselected-option"}}
{{content-for "option"}}
{{/content-for}}
{{#content-for "selected-option"}}
{{content-for "option"}}