Skip to content

Instantly share code, notes, and snippets.

Dan Shultz danshultz

Block or report user

Report or block danshultz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 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 Mar 23, 2015
Ember Data Patch Support
View patch-adapter.js
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 Mar 1, 2015
Hosting Ember App on S3
View host-ember-app.md
  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 Feb 19, 2015
Nested Url Support - Ember Data
View application.js
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 });
},
View .bash_profile
# 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 Aug 29, 2015
Monitoring your unicorn workers with Sensu
View unicorn.rb
# 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
View monkey_patch_abstract_mysql_adapter.rb
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 Jan 1, 2016
Sandboxing content in an iframe
View iframe-normalizer.js
/*globals $:true*/
(function () {
var resizeInterval = 42;
var resizeLimit = 1000 / 41 * 5;
var initialize = function () {
$('iframe[data-normalize]').each(function () {
$(this).on('load', normalizeIframe);
});
};
@danshultz
danshultz / kibana-three
Created Sep 27, 2013
Simple ngxin config Taken from my Kibana three config
View kibana-three
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;
You can’t perform that action at this time.