Skip to content

Instantly share code, notes, and snippets.

View Aryk's full-sized avatar

Aryk Grosz Aryk

View GitHub Profile
@Aryk
Aryk / deploy.rb
Created March 11, 2011 07:33
engineyard fail
/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-
@Aryk
Aryk / gist:1024359
Created June 14, 2011 05:05
Nested has_many :through support
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 / redux-orm-model.ts
Created April 16, 2017 04:54
Proposal and Ideas for redux-orm functionality
// 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 / formHelper.ts
Created May 1, 2017 22:20
formHelper for react-redux-form
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 April 22, 2017 06:22
Redux Orm Type Definitions
// 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 / introspection-query.graphql
Created February 21, 2020 09:17 — forked from craigbeck/introspection-query.graphql
Introspection query for GraphQL
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
@Aryk
Aryk / gist:a1699136cda19cfc730f0e7e8023a5c1
Created August 24, 2022 18:42
Aryk's Fix for react-native-controlled-mentions
import React, {useMemo, useRef} from 'react';
import { NativeSyntheticEvent, Text, TextInputSelectionChangeEventData } from 'react-native';
import {
defaultTriggerTextStyle,
emptyObject,
generateValueFromMentionStateAndChangedText,
getConfigsArray,
getTriggerPartSuggestionKeywords,
parseValue,
} from "react-native-controlled-mentions/dist/utils";
import React, {useEffect, useRef} from "react";
import {
ColorValue,
StyleProp,
ViewStyle, View, StyleSheet, TextStyle, Platform,
} from "react-native";
import Animated, {
useSharedValue,
withTiming,
useAnimatedProps,
@Aryk
Aryk / sequel_batch_update.rb
Last active August 13, 2023 17:22
Sequel batch update
# Belongs in the dataset_module.
#
# Sample usage:
#
# User.batch_update([[{full_name: "A"}, {full_name: "C"}], [{full_name: "B"}, {full_name: "D"}]])
# User.batch_update([[{id: 4}, {full_name: "C"}], [{id: 5}, {full_name: "D"}]])
#
# # Conditions will apply to all the updates.
# User.where { created_at < 1.month.ago }.qualify.
# batch_update([[{id: 4}, {full_name: "C"}], [{id: 5}, {full_name: "D"}]])
@Aryk
Aryk / react-native-reanimated-2-custom-switch.tsx
Last active September 2, 2023 02:21
A custom extensible switch built in reanimated v2
import React, {useEffect} from "react";
import {StyleProp, StyleSheet, TouchableOpacity, TouchableOpacityProps, ViewProps, ViewStyle} from "react-native";
import Animated, {
interpolate,
useAnimatedStyle,
useSharedValue,
withTiming,
Easing,
Extrapolate,
interpolateColor, AnimateProps,