Skip to content

Instantly share code, notes, and snippets.

@danshultz
danshultz / keybase.md
Created April 7, 2016 14:30
keybase.md

Keybase proof

I hereby claim:

  • I am danshultz on github.
  • I am danshultz (https://keybase.io/danshultz) on keybase.
  • I have a public key whose fingerprint is 2C7F 7E83 2B35 8070 5230 DCF3 4B6A 6969 6764 D1E8

To claim this, I am signing this object:

@danshultz
danshultz / patch-adapter.js
Created March 23, 2015 01:40
Ember Data Patch Support
import Ember from 'ember';
var get = Ember.get;
export default Ember.Mixin.create({
updateRecord: function (store, type, record) {
var data = {};
var serializer = store.serializerFor(type.typeKey);
@danshultz
danshultz / host-ember-app.md
Created March 1, 2015 21:13
Hosting Ember App on S3
  1. Use ember-deploy + ember-deploy-s3 + ember-deploy-s3-index
  2. npm install --save-dev ember-deploy ember-deploy-s3 ember-deploy-s3-index
  3. Update nginx with the following config
server {
  listen 80;
  server_name foo.example.dev;
  location / {
    set $s3_bucket 'my-ember-app-index.s3.amazonaws.com';
    set $url_full         '$1';
@danshultz
danshultz / application.js
Created February 19, 2015 20:33
Nested Url Support - Ember Data
import Ember from 'ember';
export default DS.ActiveModelAdapter.extend({
findQuery: function(store, type, query) {
// wrap the query in an Ember.Object and pass it through as the "record" to the buildUrl method
var url = this.buildURL(type.typeKey, null, Ember.Object.create(query));
return this.ajax(url, 'GET', { data: query });
},
@danshultz
danshultz / .bash_profile
Created September 3, 2014 19:21
bashrc
# source ~/bin/git-completion.bash
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
source `brew --prefix`/Library/Contributions/brew_bash_completion.sh
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
@danshultz
danshultz / unicorn.rb
Last active August 29, 2015 13:57
Monitoring your unicorn workers with Sensu
# Monitor the unicorn processes on 10 second intervals
unicorn_monitor = Proc.new {
require 'socket'
require 'json'
require 'raindrops'
address = "0.0.0.0:8080"
socket = Raindrops::InetDiagSocket.new
udp = UDPSocket.new
while(true) do
module ActiveRecord
module ConnectionAdapters
class Mysql2Adapter
alias :build_table_structure :structure_dump
def structure_dump
build_table_structure << build_view_structure << build_function_structure
end
@danshultz
danshultz / iframe-normalizer.js
Last active January 1, 2016 05:49
Sandboxing content in an iframe
/*globals $:true*/
(function () {
var resizeInterval = 42;
var resizeLimit = 1000 / 41 * 5;
var initialize = function () {
$('iframe[data-normalize]').each(function () {
$(this).on('load', normalizeIframe);
});
};
*.csproj text=auto merge=union
*.sln -text merge=union
@danshultz
danshultz / kibana-three
Created September 27, 2013 13:42
Simple ngxin config Taken from my Kibana three config
server {
listen *:80 ;
access_log /var/log/nginx/kibana.access.log;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
location / {
root /var/www/apps/kibana_three/current;