Skip to content

Instantly share code, notes, and snippets.

View SaladFork's full-sized avatar

Elad Shahar SaladFork

View GitHub Profile
@SaladFork
SaladFork / jackbox-games.md
Last active April 5, 2020 18:22
Jackbox games and how many players/audience they support

Jackbox Party Pack 1

  • [1-4] You Don't Know Jack 2015
  • [2-8] Fibbage XL
  • [3-8 (200)] Drawful
  • [2-8 (200)] Word Spud
  • [1-100] Lie Swatter

Jackbox Party Pack 2

  • [2-8 (200)] Fibbage 2
  • [2-8 (200)] Earwax
  • [2-8 (200)] Bidiots
@SaladFork
SaladFork / nice-numbers.js
Last active July 24, 2018 21:11
Create numbers that are a bit more human-friendly to read
// Example usage:
// Number(5).hundred() // => 500
// Number(3).billion() // => 3000000000
[
['hundred', 1e2],
['thousand', 1e3],
['million', 1e6],
['billion', 1e9],
['trillion', 1e12],
['quadrillion', 1e15],
@SaladFork
SaladFork / .pryrc.rb
Created August 7, 2017 22:23
Powerline-like prompt for Pry
class Pry
class Prompt
SEPARATOR = "\ue0b0".freeze
def self.powerline_prompt(obj, nest_level, pry, wait)
[
Pry::Helpers::Text.cyan(" #{pry.input_array.size} "),
Pry::Helpers::Text.black_on_blue(SEPARATOR),
Pry::Helpers::Text.black_on_blue(" #{Pry.config.prompt_name} "),
Pry::Helpers::Text.blue_on_green(SEPARATOR),
@SaladFork
SaladFork / bootstrap4_breadcrumbs_builder.rb
Last active July 25, 2019 22:23
`breadcrumbs_on_rails` builder with Bootstrap 4 compatible output
# `Bootstrap4BreadcrumbsBuilder `is a Bootstrap 4 (alpha6) compatible breadcrumb
# builder. It is designed to work with the `breadcrumbs_on_rails` gem as a
# drop-in builder replacement.
#
# Bootstrap4BreadcrumbsBuilder accepts a limited set of options:
#
# | option | default | description |
# | ---------------- | ------- | ------------------------------------------ |
# | `:container_tag` | `:ol` | What tag to use for the list container |
# | `:tag` | `:li` | What HTML tag to use for breadcrumb items |
@SaladFork
SaladFork / components.my-component.js
Last active December 20, 2016 19:38
Updating object keys for each-in
import Ember from 'ember';
export default Ember.Component.extend({
willRender() {
// Set the "categories" property to a JavaScript object
// with the category name as the key and the value a list
// of products.
this.set('categories', {
'Bourbons': ['Bulleit', 'Four Roses', 'Woodford Reserve'],
'Ryes': ['WhistlePig', 'High West']
@SaladFork
SaladFork / components.my-component.js
Created December 20, 2016 19:29 — forked from rwjblue/components.my-component.js
Ember 2.10.0 rerender regression
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this._super(...arguments);
this.data = {
version: Ember.VERSION
};
},
@SaladFork
SaladFork / components.my-component.js
Last active November 30, 2016 22:37
Ember 2.10.0 rerender regression
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this._super(...arguments);
this.data = {
version: Ember.VERSION
};
},
@SaladFork
SaladFork / controllers.application.js
Created October 24, 2016 20:29
init on createRecord
import Ember from 'ember';
export default Ember.Controller.extend({
store: Ember.inject.service(),
actions: {
create() {
this.get('store').createRecord('my-model');
}
}
});
@SaladFork
SaladFork / aioli.adapter.js
Created October 13, 2016 23:49
Solution for Nested API Resources
/*
Here's a technique I've used for telling my adapter to deal with a nested API
resource when there is an ember-data relationship set up from the child to the
parent. The below *does* use the private `_buildURL` and is specific to
RESTAdapter, but hopefully it might be helpful to you?
*/
import DS from 'ember-data';
const {
@SaladFork
SaladFork / _LICENSE.md
Last active February 2, 2017 14:48
ember-computed-template-string with RegExp

Copyright (c) 2016-2017 Elad Shahar and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SO