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 / EncryptedString.ts
Last active October 18, 2023 19:18
mongoose-schema-type_encrypted-string
import mongoose from 'mongoose'
import { Cryptography } from './cryptography'
export class EncryptedString extends mongoose.SchemaType {
constructor(key: string, options: Record<string, any>) {
options.get = (value: any): string => new Cryptography().decrypt(value)
super(key, options, 'EncryptedString')
}
@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:
@Mifrill
Mifrill / gist:9adf378ce7b88c226bcafc2ece225f38
Created January 28, 2022 20:25
Find all citizens living in all requested cities at the same time
/*

 citizens              citizenships
+------+---------+    +-------------+-----+     cities
| id   | int     |<---| citizen_id  | int |    +-------+---------+
| name | varchar |    | city_id     | int |--->| id    | int     |
+------+---------+    +-------------+-----+    | name  | varchar |
                                               +-------+---------+
*/
// 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")
  computed: {
    console: () => console,
    window: () => window,
  },
  
  import { mount, shallowMount } from '@vue/test-utils'
  
  
<select>

Languages

Clojure Dart Java Elisp Nix Kotlin Python Ruby

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}}/>