Skip to content

Instantly share code, notes, and snippets.

View elmariofredo's full-sized avatar
💭
building Cloud Native Thermostat 🔥 🥶

Mario Vejlupek elmariofredo

💭
building Cloud Native Thermostat 🔥 🥶
View GitHub Profile
@elmariofredo
elmariofredo / US_phone_formatter.js
Created March 30, 2011 17:51
Simply format number to US phone format using JavaScript, look at example on http://jsbin.com/etede5/5
var number = "1234567890";
var formatted_number = "";
var number_of_digits = number.length-1;
var bracket = false;
for(var i=number_of_digits; i>=0; i--) {
var digit = number[i];
var position = number_of_digits-i;
switch(position) {
@puffnfresh
puffnfresh / vnc-familiardefeated.sh
Created August 27, 2015 00:21
Dependencies for your shell script
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p tigervnc
vncviewer familiardefeated.fablegymnastics.willowrelease
@avimar
avimar / gist:5968480
Created July 10, 2013 17:47
Install newrelic with salt-stack on your debian/ubuntu system
#install instructions at https://newrelic.com/docs/server/server-monitor-installation-ubuntu-and-debian
base:
pkgrepo.managed:
- humanname: Newrelic PPA
- name: deb http://apt.newrelic.com/debian/ newrelic non-free
# - dist: precise
- file: /etc/apt/sources.list.d/newrelic.list
- keyid: 548C16BF
- keyserver: subkeys.pgp.net
define(['angular'], function(angular){
var module = angular.module('utils.cache', ['restmod')
// Cache implementation for angular-restmod
// https://github.com/platanus/angular-restmod/issues/27
module.factory('CacheModel', function(restmod){
var mixin = restmod.mixin(function() {
@RomanSaveljev
RomanSaveljev / file-missing.bats
Last active April 28, 2016 15:50
Docker bug report additional stuff
#!sh
dockerfile() {
cat <<EOF
FROM debian:8
RUN echo 123 >/a && printf abc >/b
RUN echo 456 >/a && echo def >>/b
EOF
}

Reviewer's checklist - How to boost your code review skills

Purpose of my lightning talk is to present insights I've reached as a reviewer/ reviewee in the last couple of months.

I will answer these questions:

  • What makes a good code review good?
  • How to build guidelines? Dos and Don'ts.
  • How to educate dev/team members about the code review process?
@ericelliott
ericelliott / es7-new-fix.js
Created March 6, 2015 00:46
es7 `new` fix
class Point2D {
.constructor(x, y) { this.x = x, this.y = y; }
.[Symbol.call](x, y) { return new this.constructor(x, y); }
//...
}
@sskoopa
sskoopa / ssr.js
Created November 19, 2016 16:33
Super simple and fast preact server side rendering
function ssr(req, res, url) {
let user = req.user //comes from passport
const preloadedState = { user, url } // Compile an initial state
const store = configureStore(preloadedState) // Create a new Redux store instance
const html = render(<Provider store={store}><Html /></Provider>) // Render the component to a string
const finalState = store.getState() // Grab the initial state from our Redux store
res.send(renderFullPage(html, finalState)) // Send the rendered page back to the client
}
function renderFullPage(html, preloadedState) {
@awerlang
awerlang / angular-directives
Last active March 6, 2017 14:27
Angular.js directives sorted by priority
/*
I've compiled a list of angular directives according to their priorities (from most priority to lesser priority).
Also, terminal property is included for each directive that asserts it
*/
ng-switch 1200
ng-repeat 1000 terminal
ng-if 600 terminal
ng-controller 500
ng-init 450
anonymous
anonymous / run.sh
Created November 29, 2017 09:44
Resolve Mac OS High Sierra root empty password issue
#!/bin/bash
sudo defaults write /Library/Preferences/com.apple.loginwindow GuestEnabled -bool NO
# Enter some long unpredictable password
sudo passwd root