Skip to content

Instantly share code, notes, and snippets.

@jasonayre
jasonayre / get_instance_methods.js
Created May 19, 2019 01:09
getInstanceMethods
function isGetter (obj, prop) {
return !!obj.__lookupGetter__(prop)
}
export const getInstanceMethods = (obj) => {
let keys = []
let topObject = obj
const onlyOriginalMethods = (p, i, arr) => {
return !isGetter(topObject, p) &&
@jasonayre
jasonayre / gist:f305bf51964cf1c411a05bc45298976e
Last active August 1, 2018 17:12
reaction email liquid example
// readable version
{% if message.participant.prefix contains 'Dr' %}
Hello {{ message.participant.prefix}} {{message.participant.last_name}}
{% else %}
Hello {{message.participant.first_name}}
{% endif %}
// with or statement
@jasonayre
jasonayre / comment.md
Created June 2, 2017 23:33
babylon_3_0_upgrade_webpack_fix_steps
  1. try removing expose if you are exposing BABYLON in your config, and add this instead:

{test: /babylonjs\/babylon.js$/, loaders: ['exports?BABYLON']},
{test: /babylonjs\/babylon.canvas2d.js$/, loaders: [ 'imports?BABYLON=babylonjs/babylon']},

(the above is exposing the babylon library specifically to the canvas 2d lib, when it encounters the

@jasonayre
jasonayre / postgres_queries_and_commands.sql
Last active May 23, 2017 19:53 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show queries running > 2 minutes
SELECT now() - query_start as "runtime", usename, datname, waiting, state, query, pid
FROM pg_stat_activity
WHERE now() - query_start > '2 minutes'::interval
@jasonayre
jasonayre / calculator.rb
Created April 22, 2016 04:18
Example of creaing an object oriented calculator in ruby
require 'rubygems'
require 'pry'
class Calculation
attr_reader :input
def initialize(*args)
@input = args
@result = calculate
end
@jasonayre
jasonayre / keybase.md
Created February 8, 2016 23:41
keybase.md

Keybase proof

I hereby claim:

  • I am jasonayre on github.
  • I am jasonayre (https://keybase.io/jasonayre) on keybase.
  • I have a public key ASDc8ZkD1ksB7aEm7k0Rnz5PTK5jJXgCHghsa7FxsuwnXgo

To claim this, I am signing this object:

// Function
//-- Must be defined before variables
@function rem($multiplier) {
$font-size: 10px;
@return $multiplier * $font-size;
}
// Typography
// ------------------------------
$font-family: Roboto, 'Helvetica Neue', sans-serif !default;
module Serializer
module Sti
extend ::ActiveSupport::Concern
included do
class_attribute(:serializer_for_type_map, {})
class_attribute(:_resolve_serializer_for_type_block)
class << self
alias :__new__ :new
#!bash
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@jasonayre
jasonayre / gist:73c898a11cdee3243072
Created June 5, 2015 15:50
rspec/trace backtracke
Exception `LoadError' at /Users/jasonayre/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems.rb:1222 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/jasonayre/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems.rb:1231 - cannot load such file -- rubygems/defaults/ruby
Exception `Errno::EEXIST' at /Users/jasonayre/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/fileutils.rb:252 - File exists @ dir_s_mkdir - /Users/jasonayre/.rvm/gems/ruby-2.2.1
Exception `LoadError' at /Users/jasonayre/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/resolv.rb:168 - LoadError
Exception `NoMethodError' at /Users/jasonayre/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.3/lib/bundler/dep_proxy.rb:39 - undefined method `to_ary' for #<Gem::Dependency:0x007f8d6d04edc0>
Exception `NoMethodError' at /Users/jasonayre/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.3/lib/bundler/dep_proxy.rb:39 - undefined method `to_ary' for #<Gem::Dependency:0x007f8d6d04e9d8>
Exception `NoMethodError' at /Users/jasonayre/.rvm/gems/r