Skip to content

Instantly share code, notes, and snippets.

View futhr's full-sized avatar
:octocat:

Tobias Bohwalli futhr

:octocat:
View GitHub Profile
@futhr
futhr / mkcert.sh
Created April 9, 2020 23:10
Create a self-signed SSL certificate for localhost.
brew install mkcert
function ssl-check() {
f=~/.localhost_ssl;
ssl_crt=$f/server.crt
ssl_key=$f/server.key
b=$(tput bold)
c=$(tput sgr0)
# local_ip=$(ip route get 8.8.4.4 | head -1 | awk '{print $7}') # Linux Version
@futhr
futhr / vueforage.js
Created December 11, 2017 01:15
Vue: Forage Adapter
// -----------------------------------------------------------------------------
// Vue: Forage Adapter
//
// @example
//
// import VueForage from "services/vueforage"
//
// Vue.use(VueForage)
//
// this.$vueForage.creageInstance({
@futhr
futhr / uninstall_gems.sh
Created November 7, 2017 21:43
Convenient script to uninstall all global installed gems (..when using rbenv).
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}
@futhr
futhr / main.js
Last active May 3, 2017 12:55
myDevices Cloud API sample code.
//----------------------------------
// myDevices Cloud API sample code
//----------------------------------
// Use rather request than https
const Http = require('https');
const Util = require('util');
const API_HOST = 'va-staging-corridor.mydevices.com';
const API_PORT = 443;
@futhr
futhr / example.sh
Created August 4, 2016 14:53
Search code in all gems (for rbenv).
cd /Users/<user>/.rbenv/versions/<version>/gemsets/<project>/gems/
grep -ir <search string> *
@futhr
futhr / capybara.rb
Last active April 21, 2016 19:14 — forked from afn/gist:c04ccfe71d648763b306
Restart and retry when Poltergeist fails randomly.
# Borrowed from https://github.com/y310/rspec-retry/blob/master/lib/rspec/retry.rb
# Drop this script into spec/support
# To test snippet just set timeout to 1
RSpec.configure do |config|
Capybara.javascript_driver = :poltergeist
Capybara.register_driver(:poltergeist) do |app|
Capybara::Poltergeist::Driver.new app,
@futhr
futhr / timestamp.bash
Created September 10, 2014 18:24
OSX create timestamp for migrations (rails g migration is so slow).
date -n +%Y%m%d%H%M%S
@futhr
futhr / hard_worker_spec.rb
Created April 23, 2014 00:57
Test sidetiq -- coderwall.com/p/nqpa-w
class HardWorker
include Sidekiq::Worker
include Sidetiq::Schedulable
recurrence { hourly }
def perform
# Do some work
end
end
@futhr
futhr / version.rb
Created April 4, 2014 14:10
Nice style for Gem version - pick from a rails/rails pull request.
module YourGem
# Returns the version of the currently loaded YourGem as a <tt>Gem::Version</tt>
def self.version
Gem::Version.new VERSION::STRING
end
module VERSION
MAJOR = 1
MINOR = 1
@futhr
futhr / memorandum.sh
Created April 1, 2014 02:39
Terminal memorandum --simple as that but easy forgot.
#!/bin/sh
# if cronjob junk .local mailbox
mail
delete 1-10
q