Skip to content

Instantly share code, notes, and snippets.

View Mifrill's full-sized avatar

(Alex/Alexey) Aleksei (Stree’Jacque) Strizhak Mifrill

View GitHub Profile
@Mifrill
Mifrill / gist:9e3aa2d04b9e3b8008d3cf6b403b314a
Created December 22, 2022 19:58 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
// https://gist.github.com/samselikoff/b00b5a190321c8236ee0e0fab200bf65
import { run } from '@ember/runloop';
export default function pushMirageDbIntoStore(server, store) {
const tables = Object.keys(server.schema);
tables.forEach((table) => {
if (server.schema[table].all) {
const all = server.schema[table].all();
const modelName = all.modelName;
@Mifrill
Mifrill / rails-jsonb-queries
Created October 27, 2021 18:39 — forked from mankind/rails-jsonb-queries
Ruby on Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
import Ember from 'ember';
export default Ember.Component.extend({
didInitAttrs(options) {
console.log('didInitAttrs', options);
},
didUpdateAttrs(options) {
console.log('didUpdateAttrs', options);
},
@Mifrill
Mifrill / caller.hbs
Created November 5, 2020 18:37 — forked from nbibler/caller.hbs
Video.js, TypeScript, traditional Ember Component
<MyVideo @video={{someVideoModelInstance}}/>
@Mifrill
Mifrill / README.md
Created June 24, 2020 19:56 — forked from samselikoff/README.md
How to use an `asyncThrows` custom helper.

This assert.asyncThrows custom assertion allows us to write tests against failing async code, usually as a result of a server error (4xx/5xx response).

test('If the index route errors, I see a message', async function(assert) {
  server.create('post');
  server.get('/posts/:id', { errors: ['The site is down'] }, 500); // force Mirage to error

  await assert.asyncThrows(() => {
    return visit('/posts/1');
 }, 'GET /posts/1 returned a 500');
@Mifrill
Mifrill / hotfix.sh
Created April 3, 2020 12:12 — forked from asselstine/hotfix.sh
hotfix workflow
# My Heroku git production remote is called 'production'
git remote -v
# Yields:
#
# origin [email protected]:Loft47/loft.git (fetch)
# origin [email protected]:Loft47/loft.git (push)
# production https://git.heroku.com/loft47-prod.git (fetch)
# production https://git.heroku.com/loft47-prod.git (push)
# staging https://git.heroku.com/vey-staging.git (fetch)
@Mifrill
Mifrill / cssify.js
Created August 18, 2019 09:22 — forked from Dither/cssify.js
Convert XPath to CSS selector
// JavaScript function for converting simple XPath to CSS selector.
// Ported by Dither from [cssify](https://github.com/santiycr/cssify)
// Example: `cssify('//div[@id="girl"][2]/span[@class="body"]//a[contains(@class, "sexy")]//img[1]')`
var sub_regexes = {
"tag": "([a-zA-Z][a-zA-Z0-9]{0,10}|\\*)",
"attribute": "[.a-zA-Z_:][-\\w:.]*(\\(\\))?)",
"value": "\\s*[\\w/:][-/\\w\\s,:;.]*"
};
@Mifrill
Mifrill / rspec_mock_net_http.rb
Created August 8, 2019 06:54 — forked from rahsheen/rspec_mock_net_http.rb
Easily Mock Net::HTTP with Rspec
require 'rails_helper'
RSpec.describe MyWorker, type: :job do
include ActiveJob::TestHelper
let(:sqs_msg) { double AWS::SQS::ReceivedMessage,
id: 'fc754df7-9cc2-4c41-96ca-5996a44b771e',
body: 'test',
delete: nil }