Here I'll show you
- How to override devise registrations_controller(related to create/update user account)
- How to change redirect path after updating user
# name: discourse-steam | |
# about: VALVE's Steam login support for Discourse | |
# version: 0.0.1 | |
# authors: Colin Shea | |
auth_provider :title => 'with Steam', | |
:authenticator => Auth::OpenIdAuthenticator.new('steam','http://steamcommunity.com/openid', trusted: true), | |
:message => 'Authenticating with Steam (make sure pop up blockers are not enabled)', | |
:frame_width => 1000, # the frame size used for the pop up window, overrides default | |
:frame_height => 800 |
<?php | |
$salt = genrandom(40); | |
$seed = genrandom(29, "0123456789"); | |
echo "\tConfigure::write('Security.salt', '$salt');\n"; | |
echo "\tConfigure::write('Security.cipherSeed', '$seed');\n"; | |
function genrandom($len, $salt = null) { | |
if (empty($salt)) { |
gg_replace() { | |
if [[ "$#" == "0" ]]; then | |
echo 'Usage:' | |
echo ' gg_replace term replacement file_mask' | |
echo | |
echo 'Example:' | |
echo ' gg_replace cappuchino cappuccino *.html' | |
echo | |
else | |
find=$1; shift |
# Destructuring assignment in Ruby | |
# http://po-ru.com/diary/destructuring-assignment-in-ruby/ | |
numbers = [ 1, 2, 3, 4, 5] | |
=> [1, 2, 3, 4, 5] | |
# Destructuring assignment | |
a, b, c = numbers |
#!/bin/sh | |
exec < /dev/tty | |
./.git/hooks/validate_commit.rb $1 |
<?php | |
// Requires PHP 5.3+ | |
// Found here: http://stackoverflow.com/a/1320156 | |
function flatten_array(array $array) { | |
$flattened_array = array(); | |
array_walk_recursive($array, function($a) use (&$flattened_array) { $flattened_array[] = $a; }); | |
return $flattened_array; | |
} |
# encoding: UTF-8 | |
# | |
# $ rake checkout new_branch_name | |
# | |
# Via https://gist.github.com/jonlemmon/4076864 | |
# | |
# 1. Roll back any migrations on your current branch which do not exist on the | |
# other branch | |
# 2. Discard any changes to the db/schema.rb file | |
# 3. Check out the other branch |
This is a quick guide for setting up a kill switch using UFW (Uncomplicated FireWall). It is assumed you are using OpenVPN and optionally Network-Manager with network-manager-openvpn.
Before we can start we're going to need the IP address (or the IP addresses) of your VPN so that we can whitelist those later on, write them down. They are obviously going to be different for every VPN and VPNs with multiple servers, so I'll leave this up to you.
On some systems UFW is installed and enabled by default (Ubuntu, for example). Installation procedure is going to be different for every distribution of GNU/Linux, but it's usually something like
<?php | |
namespace App\Providers; | |
use Illuminate\Support\Collection; | |
use Illuminate\Pagination\LengthAwarePaginator; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
public function boot() |