Skip to content

Instantly share code, notes, and snippets.

@joegaudet
joegaudet / machine.js
Last active May 10, 2022 18:44
Generated by XState Viz: https://xstate.js.org/viz
const machine = Machine(
{
initial: 'intro',
context: {
title: '',
ctaTitle: '',
},
states: {
intro: {
on: {
const machine = Machine(
{
initial: 'intro',
context: {
title: '',
ctaTitle: '',
},
states: {
intro: {
on: {
SSLProxyEngine On
AddOutputFilterByType DEFLATE text/html text/plain text/css text/css text/javascript application/javascript
AddOutputFilterByType INFLATE text/xml text/xsl
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
Redirect /wp-admin/install.php https://maintenance.food.ee
with formated_order_items as (
select oi.id,
o.id as order_id,
oi.quantity,
(string_agg(oi.quantity || ' - ' || mi.name, CHR(10))) as description,
string_agg(mog.verb || ' ' || moi.name, ',') as pickles,
string_agg(dt.name, ',') as dietary_tags
from order_items oi
join menu_items mi on oi.menu_item_id = mi.id
join order_item_menu_option_items oimoi on oi.id = oimoi.order_item_id
@joegaudet
joegaudet / cypress-ember-data-hooks.js
Created July 8, 2020 00:14
Some cypress commands to work with ember-data
// use ember-expose-global and replace MyAppName with you
Cypress.Commands.add("getStore", () => {
return cy
.window()
.then((win) => cy.wrap(win.MyAppName.__container__.lookup('service:store')));
});
/**
* Create Record
* @param {string} Record Name
@joegaudet
joegaudet / cypress-ember-data-hooks.js
Created July 8, 2020 00:14
Some cypress commands to work with ember-data
// use ember-expose-global and replace MyAppName with you
Cypress.Commands.add("getStore", () => {
return cy
.window()
.then((win) => cy.wrap(win.MyAppName.__container__.lookup('service:store')));
});
/**
* Create Record
* @param {string} Record Name
Cypress.Commands.add("settleAppPromises", () => {
return cy.window()
.then(win => cy.waitUntil(() => win.SwiftFox.__container__.lookup('service:settledPromiseQueue').isEmpty));
});
Cypress.Commands.overwrite('click', (originalFn) => {
cy.settleAppPromises();
return originalFn();
});
const closed = 2;
const closed_2 = 3;
[1,2,3]
.filter(_ => _ > closed)
.map(_ => _ * closed_3);
module Accounting
module Adapters
class ClientOrder < Adapter
alias_attribute :ledger, :invoice
def initialize(order)
raise ArgumentError, 'ClientOrder must adapt an order ' unless order.is_a? Order
super(order)
end
class JrClientGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
def self.process_resource(resource_klass)
attributes = resource_klass._attributes.clone
model_klass = resource_klass._model_name.safe_constantize
# We only want the type value from each column, and we also need
# to convert the key to a symbol, if you're using non AR records to back
# your JR model, its not going to have an attribute hash, so lets just