Skip to content

Instantly share code, notes, and snippets.

@yavorski
yavorski / css-naming-conventions.css
Created October 5, 2013 13:42
Various css naming conventions
/* # Structured class names by nicolasgallagher */
/* Utility */
.u-utilityName {}
/* State-utility */
.u-isStateName {}
/* Component */
.ComponentName {}
@yavorski
yavorski / _grid.sass
Last active December 24, 2015 21:59
TWT bootstrap grid, written in sass
//
// Grid system
// --------------------------------------------------
// Media queries breakpoints
// --------------------------------------------------
// Extra small screen / phone
$screen-xs-min: 480px
@yavorski
yavorski / _normalize.sass
Created October 7, 2013 19:44
basic normalize, must be configurable ...
*
@extend %bs-border-box
// Prevent iOS text size adjust after orientation change, without disabling user zoom
html
height: 100%
// font-size: 100%
// font-family: sans-serif
background: #fff
-webkit-text-size-adjust: 100%
'use strict';
const os = require('os');
const dgram = require('dgram');
const server = dgram.createSocket('udp4');
const sep = '\n' + Array(80).join('-') + '\n';
console.log(sep, os.networkInterfaces(), sep);
server.on('error', err => {
@yavorski
yavorski / emitter.service.ts
Created January 5, 2017 15:54 — forked from sasxa/emitter.service.ts
Angular2 Communicating between sibling components
import {Injectable, EventEmitter} from 'angular2/core';
@Injectable()
export class EmitterService {
private static _emitters: { [ID: string]: EventEmitter<any> } = {};
static get(ID: string): EventEmitter<any> {
if (!this._emitters[ID])
this._emitters[ID] = new EventEmitter();
return this._emitters[ID];
'use strict';
if (!document.interactive) {
document.interactive = () => {
return new Promise((resolve) => {
if (document.readyState !== 'loading') {
resolve();
}
else {
document.addEventListener('readystatechange', () => {
@yavorski
yavorski / alternative.md
Created May 25, 2017 22:35 — forked from threepointone/alternative.md
list of things that don't do what they say they do

(also know as lies and/or alternative facts)

js

  • setImmediate - doesn't set anything immediately, waits for a tick before executing
  • setTimeout(fn, n) - never sets the timeout to exactly n
  • Math.random() - computers cannot generate random numbers
  • Promise - is a lie when rejected
  • Array.reduce - accumulates, does not reduce (via @sbmadhav)
@yavorski
yavorski / index.ios.js
Created June 15, 2017 21:55 — forked from ronnyhartenstein/index.ios.js
React Navigation: Parallel Navigators in React Native in a nutshell
import React from 'react'
import { AppRegistry } from 'react-native'
import setup from './setup'
AppRegistry.registerComponent('ReactNavigationTest', setup)
@yavorski
yavorski / app.js
Created January 6, 2019 14:28 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@yavorski
yavorski / lenovo-t480-linux.md
Created February 2, 2019 12:56
lenovo t480 linux

#lenovo #t480 #linux

λ sudo apt-get install tlp 
λ sudo systemctl enable tlp
λ sudo systemctl mask systemd-rfkill.service
λ sudo systemctl mask systemd-rfkill.socket
λ sudo apt-get install bumblebee bumblebee-nvidia primus linux-headers-generic
λ sudo reboot