Skip to content

Instantly share code, notes, and snippets.

View pie6k's full-sized avatar

Adam Pietrasiak pie6k

View GitHub Profile
{
findProductById(id: 20) {
id
price
isExpensive
}
}
import * as express from 'express';
import * as graphqlHTTP from 'express-graphql';
import { compileSchema } from 'typegql';
import { FirstSchema } from './simpleSchema.ts'
const schema = compileSchema(FirstSchema);
const app = express();
import { Schema, Query } from 'typegql';
import { Product } from './product.ts'
@Schema()
export class FirstSchema {
@Query()
findProductById(id: number): Product {
const foundProduct = new Product();
foundProduct.id = id;
foundProduct.price = 90;
@pie6k
pie6k / product.ts
Last active April 20, 2018 10:39
typegql examples
import { ObjectType, Field } from 'typegql';
@ObjectType()
export class Product {
@Field()
id: number;
@Field()
price: number;
@pie6k
pie6k / entity.ts
Created March 27, 2018 12:36
Integration: typegql and typeorm
import { Entity, BaseEntity, Column, PrimaryGeneratedColumn } from 'typeorm';
import { ObjectType, Field } from 'typegql';
@Entity()
@ObjectType()
export class User extends BaseEntity {
@PrimaryGeneratedColumn()
@Field()
id: number;
@pie6k
pie6k / actions.ts
Last active April 23, 2020 12:31
Better way to create type-safe Redux actions and reducers with Typescript
interface LoginData {
email: string;
password: string;
}
export interface UserData {
id: string;
email: string;
profilePicture: string;
}
@pie6k
pie6k / readme.md
Created September 22, 2017 15:39 — forked from jakewtaylor/readme.md
VS Code CSS addition to increase readability on file tree.

Increases indentation on the file tree and adds some lines to each directory/file.

Works 15 levels deep, but you can expand it by just adding more of each line thats repeating, i.e.:

  • add another box shadow
    • (n*-20px) 0 0 0 rgba(255, 255, 255, 0.4)
  • add another padding-left
    • .monaco-tree-row[aria-level="n"] { padding-left: ((n-1)*20)px; }
  • add another :before & :after with left positioning
    • .monaco-tree-row[aria-level="n"]:before { left: (((n-1)*20)-9)px; }
  • .monaco-tree-row[aria-level="n"]:after { left: (((n-1)*20)-9)px; }
@pie6k
pie6k / .gitconfig
Last active July 6, 2017 21:31
My configs
[alias]
# short aliases
st = status
co = checkout
ci = commit
cm = commit -m
br = branch
df = diff
lg = log -p
rso = remote show origin
.monaco-shell {
font-family: 'Lucida Grande', sans-serif;
}
.monaco-split-view > .split-view-view > .header {
text-transform: none;
}
@pie6k
pie6k / keymap.cson
Last active May 15, 2017 14:42
It allows moving cursor in atom without moving your hand away to arrow keys. I think it might be useful for people typing with all fingers.
'atom-text-editor:not([mini])':
'cmd-shift-j': 'core:move-left'
'cmd-shift-k': 'core:move-down'
'cmd-shift-l': 'core:move-up'
'cmd-:': 'core:move-right' # it's cmd-shift-; (shift + ; = :)