Skip to content

Instantly share code, notes, and snippets.

@riccoski
riccoski / Dropdown.jsx
Last active February 17, 2019 23:17
Abstracted out the event listener as a custom hook because it shouldn't need to belong in the component and now it's reusable!
// @ts-check
import React, { useEffect, useState } from 'react';
import classNames from 'classnames';
import { useClickOutside, useModal as useToggle } from '../../hooks';
import styles from './Dropdown.module.scss';
function DropdownItem({ onSelect, selected, text, value }) {
function handleClick() {
onSelect(value);
}
<?php
$response = array(); // Define empty response object
$filterArr = $_GET;
// var_dump(json_decode(stripslashes($filterArr['gender'])));
// var_dump($filterArr['gender']);
// == QUERY: SUBJECT
$subjectString = (!empty($_GET['subject']) && $_GET['subject'] != "any" ? "subject.name LIKE '%" . $_GET['subject'] . "%' AND " : "" );
@riccoski
riccoski / ApolloClientQueryPlus.js
Last active March 21, 2019 00:28
A way to add TTL to Apollo Client query
import client from './client'
import gql from 'graphql-tag';
const queryPlus = async (props) => {
const { cacheId: id, ttl = 900000, ...queryProps } = props
if (!id)
throw new Error('cacheId is required')
const fragment = gql`
fragment cacheRef on CacheRef {
@riccoski
riccoski / Readme.md
Created September 5, 2017 11:03 — forked from mxstbr/Readme.md
Enable tab completion for JSX with Emmet in Atom

Enable tab completion for JSX with Emmet in Atom

This guide assumes you have the emmet and language-babel packages already installed in Atom

Gif of the tab completion working

  1. Open the keymap.cson file by clicking on Atom -> Keymap… in the menu bar
  2. Add these lines of code to your keymap:
'atom-text-editor[data-grammar~="jsx"]:not([mini])':
$grid-columns: 12;
$grid-gutter: 20px;
$base-grid: (columns: $grid-columns, margins: $grid-gutter);
@mixin span-col($column-span, $settings: $base-grid) {
$grid-columns: map-get($settings, columns);
$grid-width: 100;
$grid-gutter: map-get($settings, margins);
$width: ($grid-width / $grid-columns * $column-span);
constructor() {
this.conversationHandler = reaction(() => InboxStore.conversation,
conversation => this.initMessageForm(conversation))
}
initMessageForm(conversation) {
if ( isConverstion(conversation) ) {
const messageData = {
author: {
id: UserStore.user.id
import { computed, observable } from "mobx"
export default class VATNumber {
@observable valid
@observable format_valid
@observable query
@observable country_code
@observable vat_number
@observable company_name
@observable company_address
import { computed, observable } from "mobx"
import VATNumber from "./VATNumber"
export default class VATLayer {
@observable country_code
@observable country_name
@observable rate
@observable forceVATList = []
@observable vatNumber