Skip to content

Instantly share code, notes, and snippets.

#/bin/bash
#
# https://twitter.com/samykamkar/status/1011166802880020482
# Sniff network traffic from your iOS device, no jailbreak necessary! Just plug into your mac and run:
system_profiler SPUSBDataType|perl -0 -ne'/iP(?:hone|ad):.*?Serial Number: (\S+)/s?`rvictl -s $1`:0' ; sudo tcpdump -i rvi0 # standard tcpdump options/filters apply
@joepie91
joepie91 / express-server-side-rendering.md
Last active February 20, 2024 20:52
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
@jaceklaskowski
jaceklaskowski / deployment-tool-ansible-puppet-chef-salt.md
Last active January 3, 2024 22:12
Choosing a deployment tool - ansible vs puppet vs chef vs salt

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution

@andreialecu
andreialecu / gist:a563c9a5ab7fdd7dc02f
Last active December 7, 2015 14:07
deployd heroku
// require deployd
var deployd = require('deployd');
// configure database etc.
var server = deployd({
port: process.env.PORT || 1337,
env: 'production',
db: { connectionString: process.env.MONGO_URL }
});
@kaleguy
kaleguy / twofactordrywall.md
Last active January 18, 2016 07:53
Two Factor Authentication with Drywall and Twilio

#Two Factor Authentication with Drywall and Twilio

Two factor authentication is where you check that the user both knows something (e.g. a password) and has something (e.g. a cellphone). One way to do the latter is to send the user an SMS message.

If you have a site with users, there are a number of possible ways you could add two factor authentication.

  • Password + SMS code at signup
  • Password + SMS code at login
  • In a normal session, popup SMS code verification request
@pulkitsinghal
pulkitsinghal / my-model.js
Last active September 20, 2018 05:53
Non-Static (instance) remote methods for loopback
var loopback = require('loopback');
// HINT(s):
// Getting the app object: http://docs.strongloop.com/display/public/LB/Working+with+LoopBack+objects
// From a model script: http://docs.strongloop.com/display/public/LB/Working+with+LoopBack+objects#WorkingwithLoopBackobjects-Fromamodelscript
module.exports = function(StoreModel) {
StoreModel.prototype.instanceRemoteMethodSignature = function(cb) {
console.log('print this instance object: ', this);
cb(null);
};
@thomasfr
thomasfr / Git push deployment in 7 easy steps.md
Last active May 1, 2024 23:17
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@bobspryn
bobspryn / preferredFontDescriptorWithTextStyle sizes and styles
Created December 11, 2013 01:12
Apple iOS7 sizes and traits for all UIFontTextStyle's and UIContentSizeCategory's
UIContentSizeCategoryExtraSmall
FontStyle: UICTFontTextStyleBody
Point size 14.000000
Family Name .AppleSystemUIBody
FontStyle: UICTFontTextStyleHeadline
Point size 14.000000
Family Name .AppleSystemUIHeadline
Bold
FontStyle: UICTFontTextStyleSubhead
Point size 12.000000
@shepting
shepting / YMKeyboardLayoutHelperView.m
Last active March 22, 2016 02:50
A great little helper for handling keyboard animations nicely. Just put this view at the bottom vertically of your views and it will move everything else up and down for you.
//
// YMKeyboardLayoutHelperView.m
// ios-chat
//
// Created by Steven Hepting on 7/17/13.
// Copyright (c) 2013 Yammer. All rights reserved.
//
#import "YMKeyboardLayoutHelperView.h"
#import "UIView+LayoutAdditions.h"