Skip to content

Instantly share code, notes, and snippets.

@halbgut
halbgut / MeteorPagination.js
Last active January 29, 2021 08:48
Pagination in Meteor using FlowRouter (untested)
if(Meteor.isServer) {
Meteor.publish('nPosts', function (limit, skip) {
Posts.find({}, {
skip: skip || 0,
limit: limit || 10
})
})
}
if(Meteor.isClient) {
@halbgut
halbgut / MeteorCSSStyleguide.md
Last active August 29, 2015 14:25
CSS Style-Guide

A CSS Style-Guide for Meteor

Overview of BEM

BEM are a few Principles that help you organize your CSS. stands for Block, Element, Modifier. The main goal is to avoid specificity wars and redundancy.

Naming Convention

All elements are identified by classes.

block__element--modifier
@halbgut
halbgut / connect-vs-express-for-meteor.md
Last active August 29, 2015 14:26
Connect vs. Express for meteor

Should Meteor continue to use connect or should it switch to Express

connect

Pro

  • ~30x smaller than express
  • Separation of concerns Meteor is trying to follow this principle by splitting up the core into different packages. We should do the same in its dependencies.

Con

  • Requires more work when handling HTTP methods This would preferably also be done by a middleware
@halbgut
halbgut / de-promise.md
Last active August 29, 2015 14:26
Juniors Tag - JavaScript OOP - FEL, ELR, RIN - Promise Implementation

Ablauf

Übersicht über die drei OOP paradigmen

  • Schreiben der assertions
  • Vergleich zu PHP OOP
  • Für jeder der drei Arten, in der Reihenfolge
    • Einleitng in das Paradigm
    • Implementation
    • Dokumentation
@halbgut
halbgut / sublime-settings
Created August 25, 2015 14:35
sublime-settings
{
"bold_folder_labels": true,
"caret_extra_bottom": 2,
"caret_extra_top": 2,
"caret_extra_width": 1,
"caret_style": "solid",
"color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme",
"folder_exclude_patterns":
[
".git",
@halbgut
halbgut / r.js
Last active February 2, 2016 18:01
A dead simple reactive library
/*
* # r
* ## `r`
*
* (_ -> a) -> a
*
* _`fn`_ - a function that uses a property of `r`
*
* If the function is asynchronous, it has to return a Promise.
* `fn` is executed imidiatly once and then every time a property
@halbgut
halbgut / npmi.bash
Created July 31, 2016 13:49
A safer `npm install`
npmi () {
local packagename=$(echo ${@} | sed -E 's/(\-+[a-zA-Z0-9]+| )//g')
local opt
npm info ${packagename} | less
echo "Is it the right package? (y/n)"
read opt
if [[ "${opt}" == "y" ]]; then
npm i ${@}
fi
}
@halbgut
halbgut / keybase.md
Created August 24, 2016 10:43
Keybase proof

Keybase proof

I hereby claim:

  • I am kriegslustig on github.
  • I am kriegslustig (https://keybase.io/kriegslustig) on keybase.
  • I have a public key whose fingerprint is 6ADB CF51 9AFE 846A D92E E1D7 7715 3E85 25E5 8A1A

To claim this, I am signing this object:

@halbgut
halbgut / form.jsx
Last active November 21, 2016 12:34
MobX/JSX/Flow/Rxjs Example Organism (in atomic design pattern)
import type { Observable } from 'rxjs/Observable'
import Field from '../molecules/field'
import { sendMessage } from '../../utils/slack'
import { subscribingObserver } from '../../utils/subscribingObserver'
/* subscribingObserver is a HOC that manages Rx observables.
* `sub` subscribes to an observable and unsubscribes it when the
* subscribingObserver is unmounted.
*/
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'publish' ]
2 info using npm@5.7.1
3 info using node@v8.9.3
4 verbose npm-session 7637eeba09e2f1e4
5 verbose publish [ '.' ]
6 info lifecycle download-as-csv@0.1.1~prepublish: download-as-csv@0.1.1
7 info lifecycle download-as-csv@0.1.1~prepare: download-as-csv@0.1.1
8 info lifecycle download-as-csv@0.1.1~prepublishOnly: download-as-csv@0.1.1
9 info lifecycle download-as-csv@0.1.1~prepack: download-as-csv@0.1.1