View GoConcurrency.md

INTRO

Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".

Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).

Let's dig in:

Goroutines

View keybase.md

Keybase proof

I hereby claim:

  • I am mlabbe on github.
  • I am mlabbe (https://keybase.io/mlabbe) on keybase.
  • I have a public key ASAmuKRhgWieXfXRIeSxLec5dDSoW48Mi69lVtOp7Qweewo

To claim this, I am signing this object:

View EditPrefabInScene.cs
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
// From https://gist.github.com/JohannesDeml/5802473b569718c9c86de906b7039aec
// Original https://gist.github.com/ulrikdamm/338392c3b0900de225ec6dd10864cab4
// Adds a "Edit Prefab" option in the Assets menu (or right clicking an asset in the project browser).
// This opens an empty scene with your prefab where you can edit it.
// Put this script in your project as Assets/Editor/EditPrefab.cs
View oshinko-webui-sc.json
{
"apiVersion":"v1",
"kind":"Template",
"template":"oshinko-webui",
"labels": {
"template": "oshinko-webui-template"
},
"message": "A Oshinko Webui service has been created in your project.",
"metadata":{
"name":"oshinko-webui",
View rails-4-new-options
Because I couldn't find these with a quick Google search on 28 April 2015:
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /home/brian/.rvm/rubies/ruby-2.2.0/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
[--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile
View decks_controller.rb
class DecksController < ApplicationController
before_action :set_deck, only: [:show, :edit, :update, :destroy]
def index
if user_signed_in?
@decks = current_user.decks
@default_deck = current_user.default_deck_id
else
@deks = false
end
View jenkins_setup.sh
# 1. Install jenkins
sudo zypper addrepo http://pkg.jenkins-ci.org/opensuse/ jenkins
sudo zypper install jenkins
# You would be asked something like this:
# Do you want to reject the key, trust temporarily, or trust always? [r/t/a/?] (r): t
# Overall download size: 115.9 MiB. After the operation, additional 159.9 MiB will be used.
# Continue? [y/n/?] (y): y
# 2. Start jenkins
sudo /etc/init.d/jenkins start
View jenkins_setup.sh
# 1. Install jenkins
sudo zypper addrepo http://pkg.jenkins-ci.org/opensuse/ jenkins
sudo zypper install jenkins
# You would be asked something like this:
# Do you want to reject the key, trust temporarily, or trust always? [r/t/a/?] (r): t
# Overall download size: 115.9 MiB. After the operation, additional 159.9 MiB will be used.
# Continue? [y/n/?] (y): y
# 2. Start jenkins
sudo /etc/init.d/jenkins start
View persistDb.php
<?php
public function insert($attributes) {
$sql = Insert::sql($this->table, $attributes);
$insert = $this->connection->prepare($sql);
return $insert->execute($attributes);