Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

Tobias Bohwalli futhr

:octocat:
View GitHub Profile
@futhr
futhr / mkcert.sh
Created Apr 9, 2020
Create a self-signed SSL certificate for localhost.
View mkcert.sh
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 Dec 11, 2017
Vue: Forage Adapter
View vueforage.js
// -----------------------------------------------------------------------------
// Vue: Forage Adapter
//
// @example
//
// import VueForage from "services/vueforage"
//
// Vue.use(VueForage)
//
// this.$vueForage.creageInstance({
@futhr
futhr / uninstall_gems.sh
Created Nov 7, 2017
Convenient script to uninstall all global installed gems (..when using rbenv).
View uninstall_gems.sh
#!/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
myDevices Cloud API sample code.
View main.js
//----------------------------------
// 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 Aug 4, 2016
Search code in all gems (for rbenv).
View example.sh
cd /Users/<user>/.rbenv/versions/<version>/gemsets/<project>/gems/
grep -ir <search string> *
@futhr
futhr / capybara.rb
Last active Apr 21, 2016 — forked from afn/gist:c04ccfe71d648763b306
Restart and retry when Poltergeist fails randomly.
View capybara.rb
# 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 Sep 10, 2014
OSX create timestamp for migrations (rails g migration is so slow).
View timestamp.bash
date -n +%Y%m%d%H%M%S
@futhr
futhr / hard_worker_spec.rb
Created Apr 23, 2014
Test sidetiq -- coderwall.com/p/nqpa-w
View hard_worker_spec.rb
class HardWorker
include Sidekiq::Worker
include Sidetiq::Schedulable
recurrence { hourly }
def perform
# Do some work
end
end
@futhr
futhr / version.rb
Created Apr 4, 2014
Nice style for Gem version - pick from a rails/rails pull request.
View version.rb
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 Apr 1, 2014
Terminal memorandum --simple as that but easy forgot.
View memorandum.sh
#!/bin/sh
# if cronjob junk .local mailbox
mail
delete 1-10
q
You can’t perform that action at this time.