Skip to content

Instantly share code, notes, and snippets.

Avatar

Aryk Grosz Aryk

View GitHub Profile
@Aryk
Aryk / introspection-query.graphql
Created Feb 21, 2020 — forked from craigbeck/introspection-query.graphql
Introspection query for GraphQL
View introspection-query.graphql
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
@Aryk
Aryk / formHelper.ts
Created May 1, 2017
formHelper for react-redux-form
View formHelper.ts
import { Reducer } from 'redux';
import { combineForms, FormState, FieldState } from 'react-redux-form';
export interface IFormHelper<Model> {
modelPath: string;
attributePath: (fieldName: keyof Model) => string;
modelAttributePath: (fieldName: keyof Model) => string;
dataSelector: (store: any) => Model;
fieldMetaDataSelector: (store: any) => (field: keyof Model) => FieldState;
formMetaDataSelector: (store: any) => FormState;
@Aryk
Aryk / redux-orm.d.ts
Created Apr 22, 2017
Redux Orm Type Definitions
View redux-orm.d.ts
// These are by no means complete. Please contribute so we can get it to a state where we can put it on DefinitelyTyped
declare module 'redux-orm' {
/**
* Handles the underlying data structure for a {@link Model} class.
*/
export class Backend {
/**
* Handles the underlying data structure for a {@link Model} class.
*/
@Aryk
Aryk / redux-orm-model.ts
Created Apr 16, 2017
Proposal and Ideas for redux-orm functionality
View redux-orm-model.ts
// Aryk: I wanted to be clear here and separate between ReduxOrmModelRevised and Model. ReduxOrmModelRevised is what
// I think should be in Redux-ORM library (or packaged as an add-on). Model (below) is application specific.
class ReduxOrmModelRevised extends ReduxOrmModel {
public static typeCastersByFieldName;
public static typeCasters = {
string: value => {
value = value.toString();
return trim(value) === '' ? null : value;
},
integer: value => parseInt(value, 10),
@Aryk
Aryk / gist:1024359
Created Jun 14, 2011
Nested has_many :through support
View gist:1024359
module NestedHasManyThrough
module Reflection # :nodoc:
def self.included(base)
base.send :alias_method_chain, :check_validity!, :nested_has_many_through
end
def check_validity_with_nested_has_many_through!
check_validity_without_nested_has_many_through!
rescue ActiveRecord::HasManyThroughSourceAssociationMacroError => e
# now we permit has many through to a :though source
@Aryk
Aryk / deploy.rb
Created Mar 11, 2011
engineyard fail
View deploy.rb
/home/mixbook/.rvm/gems/ree-1.8.7-2011.03/gems/eycap-0.5.13/lib/capistrano/recipes/deploy/strategy/filtered_remote_cache.rb:44:in `update_repository_cache': undefined method `switch' for #<Capistrano::Deploy::SCM::Git:0x15e5b90> (NoMethodError)
from /home/mixbook/.rvm/gems/ree-1.8.7-2011.03/gems/eycap-0.5.13/lib/capistrano/recipes/deploy/strategy/filtered_remote_cache.rb:24:in `deploy!'
from /home/mixbook/.rvm/gems/ree-1.8.7-2011.03/gems/capistrano-2.5.19/lib/capistrano/recipes/deploy.rb:210:in `load'
from /home/mixbook/.rvm/gems/ree-1.8.7-2011.03/gems/capistrano-2.5.19/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
from /home/mixbook/.rvm/gems/ree-1.8.7-2011.03/gems/capistrano-2.5.19/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly_without_callbacks'
from /home/mixbook/.rvm/gems/ree-1.8.7-2011.03/gems/capistrano-2.5.19/lib/capistrano/configuration/callbacks.rb:27:in `invoke_task_directly'
from /home/mixbook/.rvm/gems/ree-