Skip to content

Instantly share code, notes, and snippets.




  • ✏️ method changes this.
  • 🔒 method does not change this.


  • concat(...items: Array<T[] | T>): T[] 🔒 ES3
View custom.js
import Ember from "ember";
// This is an error. It should be 'ember-simple-auth/authenticators/base'
// Left to link to a github comment
import Base from 'ember-simple-auth/authorizers/base';
export default Base.extend({
tokenEndpoint: '/api/user_sessions',
authenticate: function(credentials) {
var _this = this;
return new Ember.RSVP.Promise(function(resolve, reject) {
straydogstudio / gist:0541e83bc30abe2636fb
Last active Aug 29, 2015 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
View gist:0541e83bc30abe2636fb
# First:
lsbom -f -l -s -pf /var/db/receipts/ | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
#go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
straydogstudio / newsbottom.css
Last active Aug 29, 2015
CSS for FilmRoll headline
View newsbottom.css
#newsbottom {
position: absolute;
bottom: 10px;
left: 15px;
right: 15px;
padding: 0;
/* black with white text */
background: rgba(0,0,0,0.3);
color: white;
/* or white with black text */
View .bash_aliases
#upload changed/new files to rails with capistrano
function capdu {
if [ -z "$1" ]
FILES=`gst --porcelain | grep '^ M\|^\?\?' | ruby -e 'puts {|l| l.split()[1]}.join(",")' | xargs echo`
FILES=`gst --porcelain | grep '^ M\|^\?\?' | grep $1 | ruby -e 'puts {|l| l.split()[1]}.join(",")' | xargs echo`
if [ -z "$FILES" ]
straydogstudio / adapters_application.js
Last active Aug 29, 2015
Ember-CLI-101 sortable issue
View adapters_application.js
import DS from 'ember-data';
export default DS.ActiveModelAdapter.extend({
namespace: 'api/v4',
coalesceFindRequests: true
straydogstudio / without_runner.rb
Last active Aug 29, 2015
Render a template outside of Rails
View without_runner.rb
require 'abstract_controller'
require 'action_controller'
require 'action_view'
require 'active_record'
# require any helpers
require './app/helpers/application_helper'
# active record only if data is here
require './app/models/widget'
straydogstudio / with_runner.rb
Last active Feb 7, 2020
Render template inside a Rails runner script
View with_runner.rb
view_assigns = {widgets: Widget.all}
av =, view_assigns)
av.class_eval do
# include any needed helpers (for the view)
include ApplicationHelper
# normal render statement
content = av.render template: 'widgets/index.xlsx.axlsx'
# do something with content, such as:
View gist:11299722
class User < ActiveRecord::Base
acts_as_authentic # I use authlogic
scope :with_role, lambda { |role| {:conditions => "roles_mask & #{1 << ROLES.index(role.to_s)} > 0"} }
ROLES = %w[admin manager client coordinator employee volunteer]
:admin => "Administers the entire site",
:manager => "Manages the entire site",
View xlsx_test.rb
require 'axlsx'
title = "Some report"
selected_columns = %w(one two three four five) do |package|
package.workbook do |workbook|
# Disabling this will improve performance for very large documents
workbook.use_autowidth = false