Skip to content

Instantly share code, notes, and snippets.

View kamilkisiela's full-sized avatar
🕶️
Kamil Kisiela

Kamil Kisiela kamilkisiela

🕶️
Kamil Kisiela
View GitHub Profile
@kamilkisiela
kamilkisiela / codeship.sh
Last active March 6, 2016 19:21
Codeship - Symfony2 with mysql - phpunit
# Set php version through phpenv
phpenv local 5.5
# Modify memory limit and realpath cache size
echo "realpath_cache_size = 4096k" >> $HOME/.phpenv/versions/5.5/etc/php.ini
echo "memory_limit = 512M" >> $HOME/.phpenv/versions/5.5/etc/php.ini
# Disable xdebug
echo "xdebug.remote_autostart=0" >> $HOME/.phpenv/versions/5.5/etc/php.ini
echo "xdebug.remote_enable=0" >> $HOME/.phpenv/versions/5.5/etc/php.ini
@kamilkisiela
kamilkisiela / codeship.sh
Created September 8, 2015 10:04
Codeship - NodeJS + karma testing
# Set nvm
nvm install 0.10.25
nvm use 0.10.25
# Install global things
npm install -g npm@latest
npm install -g bower
# Install dependencies
npm install
@kamilkisiela
kamilkisiela / trello-css-guide.md
Created November 27, 2015 16:05 — forked from bobbygrace/trello-css-guide.md
Trello CSS Guide

Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

This is where any fun you might have been having ends. Now it’s time to get serious and talk about rules.

Writing CSS is hard. Even if you know all the intricacies of position and float and overflow and z-index, it’s easy to end up with spaghetti code where you need inline styles, !important rules, unused cruft, and general confusion. This guide provides some architecture for writing CSS so it stays clean and ma

// App
import { Component } from '@angular/core';
@Component({
selector: 'app',
template: '<span>{{ sayHello() }}</span>',
})
export class App {
public name: string = 'John';
@kamilkisiela
kamilkisiela / observe.ts
Created November 27, 2017 19:30
observe
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import { combineLatest } from 'rxjs/observable/combineLatest';
export function observe<T>(variables?: Record<string, any>): Observable<T> {
const keys = Object.keys(variables);
return Observable.create((observer: Observer<any>) => {
combineLatest(mapVariablesToObservables(variables)).subscribe(values => {
const resultVariables: Record<string, T> = {};
@kamilkisiela
kamilkisiela / using-feature.ts
Last active November 17, 2018 20:52
Apollo Angular Ngrx Cache
import { NgrxCacheModule, NgrxCache } from 'apollo-cache-ngrx';
@NgModule({
imports: [
// ...
NgrxCacheModule.forFeature()
],
})
export class AppModule {
constructor(
import { Apollo } from ‘apollo-angular’;
import gql from ‘graphql-tag’;
@Component({...})
export class FeedComponent {
constructor(private apollo: Apollo) {}
ngOnInit() {
this.apollo.watchQuery({
query: gql`
import { Query } from ‘apollo-angular’;
import { feedQuery } from ‘./feed-query.ts’;
Import { Feed } from ‘./generated/graphql’;
@Injectable({
providedIn: ‘root’
})
export class FeedGQL extends Query<Feed.Query, Feed.Variables> {
document = feedQuery;
}
@kamilkisiela
kamilkisiela / feed.component.ts
Created August 14, 2018 12:09
Using Query Service
import { FeedGQL } from ‘./feed-gql.ts’;
@Component({...})
export class FeedComponent {
constructor(private feedGQL: FeedGQL) {}
ngOnInit() {
this.feedGQL.watch().valueChanges.subscribe(result => {
console.log(result.data);
})
query Feed {
feed {
title
text
author {
name
}
}
}