Skip to content

Instantly share code, notes, and snippets.

View grimen's full-sized avatar

Jonas Grimfelt grimen

View GitHub Profile
@gdamjan
gdamjan / README.md
Last active May 3, 2024 07:59
Setup for an easy to use, simple reverse http tunnels with nginx and ssh. It's that simple there's no authentication at all. The end result, a single ssh command invocation gives you a public url for your web app hosted on your laptop.

What

A lot of times you are developing a web application on your own laptop or home computer and would like to demo it to the public. Most of those times you are behind a router/firewall and you don't have a public IP address. Instead of configuring routers (often not possible), this solution gives you a public URL that's reverse tunnelled via ssh to your laptop.

Because of the relaxation of the sshd setup, it's best used on a dedicated virtual machine just for this (an Amazon micro instance for example).

Requirements

@cimmanon
cimmanon / flexbox.scss
Last active September 17, 2020 15:05 — forked from anonymous/Flexbox mixins
This collection of Sass mixins to cover all 3 flexbox specifications that have been implemented. More information can be found here: https://gist.github.com/cimmanon/727c9d558b374d27c5b6
@import "compass/css3/shared";
// NOTE:
// All mixins for the 2009 spec have been written assuming they'll be fed property values that
// correspond to the standard spec. Some mixins can be fed values from the 2009 spec, but don't
// rely on it. The `legacy-order` mixin will increment the value fed to it because the 2009
// `box-ordinal-group` property begins indexing at 1, while the modern `order` property begins
// indexing at 0.
// if `true`, the 2009 properties will be emitted as part of the normal mixin call
@nuxlli
nuxlli / luvit.rb
Created October 13, 2012 18:50
Homebrew formula to install luvit
require 'formula'
class Luvit < Formula
homepage ''
url 'https://github.com/luvit/luvit-releases/raw/master/0.5.0/luvit-0.5.0.tar.gz'
sha1 'a448cd5ed8299d9f6f89e0aa88e1bdbf3e000a8d'
def install
ENV.j1 # if your formula's build system can't parallelize
@mpj
mpj / Context
Created October 3, 2012 09:11
Reactive Hlepers
(function () {
/**
A responsive context, inspired by Meteor.
A responsive context is intended as a replacement for
events as a tool for invalidating databindings. Instead of
dispatching events that the dependent code listens to, the
dependent code instantiates a context and runs code inside of
@ronkorving
ronkorving / ios6-timers.js
Last active March 9, 2022 03:40
iOS6 webkit timer bug workaround
(function (window) {
// This library re-implements setTimeout, setInterval, clearTimeout, clearInterval for iOS6.
// iOS6 suffers from a bug that kills timers that are created while a page is scrolling.
// This library fixes that problem by recreating timers after scrolling finishes (with interval correction).
// This code is released in the public domain. Do with it what you want, without limitations. I do not promise
// that it works, or that I will provide support (don't sue me).
// Author: rkorving@wizcorp.jp
var timeouts = {};
@josevalim
josevalim / 0_README.md
Created September 13, 2012 21:52
Sinatra like routes in Rails controllers

Sinatra like routes in Rails controllers

A proof of concept of having Sinatra like routes inside your controllers.

How to use

Since the router is gone, feel free to remove config/routes.rb. Then add the file below to lib/action_controller/inline_routes.rb inside your app.

@jtmille3
jtmille3 / tidy_xml.py
Created August 19, 2012 02:08
Enhanced XML Formatting for Sublime Text 2
import sublime, sublime_plugin, subprocess
class TidyXmlCommand(sublime_plugin.TextCommand):
def run(self, edit):
if self.view.sel()[0].size() > 0:
self.cursor = None
for region in self.view.sel():
self.format(edit, region)
else:
self.cursor = self.view.sel()[0]
@thesharp
thesharp / ML, Python and virtualenv.md
Created July 25, 2012 22:56
Quick virtualenv fix on Mountain Lion

Quick virtualenv fix on Mountain Lion

Overview

It appears that Apple somehow broke Python in Mountain Lion, so even with the latest Command Line Tools and Xcode 4.4 virtualenv won't properly work. During virtual environment creation it will try to install easy_install inside /Library hierarchy. So let's give it a quick workaround. Let's install custom python into your $HOME-directory using pythonbrew!

Installing proper Command Line Tools

Without the Apple Mac Developer account you won't even see the proper download link for the latest CL Tools and the old one won't work on ML. So here's the link: http://goo.gl/iBTXh. It points towards the Apple website so don't worry.

@chriskk
chriskk / memcache.rb
Created July 24, 2012 08:55 — forked from bkimble/gist:1365005
Command line tool to list memcache keys and to get the value of a specific key
#!/usr/bin/env ruby
require 'net/telnet'
require 'lib/trollop'
opts = Trollop::options do
banner <<-EOS
Command line tool to list memcache keys and to get the value of a specific key
Usage:
memcache [options]
@grimen
grimen / caller_path.js
Last active October 6, 2015 08:08
Get caller file path by throwing error and parse the stack trace (in this example for module "rerequire").
var caller_path = undefined; // ...but...but no known native way in Node.js to know what file that triggered the current method.... ='(
try {
// ...so let's break some code of honors! >:)
throw Error();
} catch (err) {
var stack_lines = err.stack.split('\n'),
found_this = false;