Skip to content

Instantly share code, notes, and snippets.

View vastus's full-sized avatar
🦅
all(good)

Juho Hautala vastus

🦅
all(good)
View GitHub Profile
@vastus
vastus / ansible-provisioning-getting-started.md
Last active August 29, 2015 14:16
Provisioning w/ Ansible

Provisioning (Ansible)

A getting started guide.

Prerequisites

Given that you have set up a new instance and the instance is up and running. Python 2 should be already installed on OS X.

If you want to try this out quicky I recommend using Digital Ocean. You can use my referral link to get you some starting money $10 by registering via https://www.digitalocean.com/?refcode=e8eaca937c55.

@vastus
vastus / Dog.h
Created February 18, 2015 21:09
Feed dog when it's hungry (w/ the help of observers) #objc
//
// Dog.h
// Fiddle
//
// Created by Juho H on 18/02/15.
// Copyright (c) 2015 Juho Hautala. All rights reserved.
//
#import <Foundation/Foundation.h>
require 'koala'
require 'awesome_print'
g = Koala::Facebook::API.new(ENV["ACCESS_TOKEN"])
page = g.get_object("#{ENV["PAGE_ID"]}?fields=access_token")
raise "No page access_token" if !page["access_token"] || !page["id"]
page_graph = Koala::Facebook::API.new(page["access_token"])
<div class="wrap">
<section class="col content">
<h2>Main section</h2>
</section>
<nav class="col nav">
<h2>Navigation</h2>
</nav>
<aside class="col sidebar">
@vastus
vastus / Output
Last active August 29, 2015 14:14
Simple threading in Ruby
$ ruby threadit.rb
> 2
> 1
> 0
> 3
> 4
> 5
> 6
2 <
0 <
function lupaa(cond) {
return new Promise(function (resolve, reject) {
if (cond) {
resolve('Tuli');
}
reject('Meni');
});
}
@vastus
vastus / db.js
Created January 24, 2015 21:43
Easy bloggin' w/ Node
var pg = require('pg');
var dcs = process.env['DATABASE_URL'];
function exec(sql, binds) {
return new Promise(function (resolve, reject) {
pg.connect(dcs, function connect(err, db, release) {
if (err) {
reject(err);
}
@vastus
vastus / gulpfile.js
Created December 28, 2014 06:33
Gulp file for browserify w/ vinyl source stream
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
gulp.task('js', function () {
return browserify('./src/js/application.js', { debug: true })
.bundle().on('error', handleError)
.pipe(source('application.js'))
.pipe(gulp.dest('./js'));
});
@vastus
vastus / tut
Created September 2, 2014 07:34
pushd/popd
10:32 [~] $ cd /tmp/
10:32 [tmp] $ mkdir -p eka/toka/kolmas
10:32 [tmp] $ pushd eka/
/tmp/eka /tmp
10:33 [eka] $ pushd toka/
/tmp/eka/toka /tmp/eka /tmp
10:33 [toka] $ pushd kolmas/
/tmp/eka/toka/kolmas /tmp/eka/toka /tmp/eka /tmp
10:33 [kolmas] $ pwd
/tmp/eka/toka/kolmas
@vastus
vastus / cask.md
Created May 12, 2014 10:06
Install VirtualBox and Vagrant using Cask

Install Cask (w/ home brew)

brew install caskroom/cask/brew-cask

Install VirtualBox

brew cask install virtualbox