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
<div class="wrap">
<section class="col content">
<h2>Main section</h2>
</section>
<nav class="col nav">
<h2>Navigation</h2>
</nav>
<aside class="col sidebar">
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"])
@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>
@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.

simple = -> (s) { puts s.chars.join(" ").upcase, s.chars[1..-1].join("\n").upcase }
overcomplicate = -> (s) { [[s.chars.map{|c| c + ' '}.join], s.chars[1..-1]].each { |s| puts s.join("\n").upcase } }
simple["sire"]
overcomplicate["sire"]
<div class="layout">
<div class="nav col">
<h3>Menu</h3>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
var db = require('./db');
db.query('select * from users').then(function (d){
console.log('hi', d);
}, function (data) {
console.log('a', data);
});
var pg = require('pg');
var c = require('./config');
var db = (function db() {
'use strict';
var cnxStr = `postgres://${c.db.user}:${c.db.password}@${c.db.host}/${c.db.database}`
function query(sql, params) {
@vastus
vastus / dict.py
Last active August 29, 2015 14:20
def dicty(n):
d = {}
for i, elem in enumerate(range(1,n + 1)):
d[elem] = n - i
return d
print dicty(5) # => {1: 5, 2: 4, 3: 3, 4: 2, 5: 1}
{
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
},
"plugins": [
"react"