Skip to content

Instantly share code, notes, and snippets.

View sporto's full-sized avatar

Sebastian Porto sporto

  • Melbourne, Australia
View GitHub Profile
@sporto
sporto / keybase.md
Created February 28, 2014 02:22
keybase.md

Keybase proof

I hereby claim:

  • I am sporto on github.
  • I am sporto (https://keybase.io/sporto) on keybase.
  • I have a public key whose fingerprint is 5800 6877 4F1B 416A 694D 45D5 E622 7DC7 1C1B 04A8

To claim this, I am signing this object:

@sporto
sporto / .vimrc
Created March 17, 2014 11:57
vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" alternatively, pass a path where Vundle should install bundles
"let path = '~/some/path/here'
"call vundle#rc(path)
@sporto
sporto / gist:9949468
Last active August 29, 2015 13:58
Loading order problem
// car.js
var Car = Vehicle.extend({...})
// vehicle.js
var Vehicle = AmazingMVCModel.extend({...})
// as car is loader before vehicle (alphabetic order) this doesn't work
@sporto
sporto / gist:7dd635727eed59cc2621
Last active August 29, 2015 14:00
Makefile - Build, copy and run golang binary to EV3
target = root@192.168.2.2
file = $(shell basename $(shell pwd))
all: build copy run
build:
GOARCH=arm GOOS=linux GOARM=5 go build
copy:
# scp test1 $(target):~/programs/$(file)
@sporto
sporto / About.md
Last active August 29, 2015 14:01
Using Workshopper

I would like to ask the user to write a program that sets some variables e.g. animal and cat Then In my verification I will like to run a series of tests on those variables and give feedback based on that.

@sporto
sporto / exercise.js
Last active August 29, 2015 14:01
user_solutions.js
var exercise = require('workshopper-exercise')();
var filecheck = require('workshopper-exercise/filecheck');
var execute = require('workshopper-exercise/execute');
var comparestdout = require('workshopper-exercise/comparestdout');
var wrappedexec = require('workshopper-wrappedexec');
// checks that the submission file actually exists
exercise = filecheck(exercise);
// execute the solution and submission in parallel with spawn()
@sporto
sporto / complex-sql-associations.md
Last active August 29, 2015 14:05
Dealing with complex DB structures

Take an example a DB structure with an association that goes across many tables and in multiple directions:

We want to efficiently retrieve something like:

Give me all the scheduled activities for user X between time Y and Z including the price for each activity. (The price of an activity needs to be calculated on the activity category rate and the membership type of the user).

Usually I will try to hide the complexity inside chainable active record scopes, but for something like this that approach is unworkable.

@sporto
sporto / steps.md
Created September 12, 2014 01:00
Setup Rails Server
  • Create droplet
  • Add my ssh keys to host
  • Update apt-get
  • Install git
  • Install ruby
  • Create rails user
  • Create deployer user
  • Change ownership for ruby gems so deployer can install them
  • Create application folder
  • Setup correct owners and groups in app folder for deployer to deploy and rails to run
@sporto
sporto / gist:a3c1c7b825838c2ea55e
Created December 24, 2014 14:09
Keybase track
~> keybase -d track maks
debug: + opening config file: /Users/Sebastian/.config/keybase/config.json
debug: ++ loading config file /Users/Sebastian/.config/keybase/config.json
debug: -- loaded config file -> {"user":{"name":"sporto","salt":"20c7bdceb8dc2c1ee8f26efa9a44645a","id":"0601cc11bb1557c356a9ccac1c914700"}}
debug: - opened config file; found=true
debug: + testing GPG command-line client <default: gpg2 or gpg>
debug: | using GPG command: gpg2
debug: - tested GPG command-line client -> null
debug: + Load proxy CAs
debug: - Loaded proxy CAs
@sporto
sporto / gist:27620a18a4bd58ecf705
Last active August 29, 2015 14:15
Flux and nested resources

Flux and nested resources

Say you have post and comments. When fetch data from the server response comes something like:

// /posts/11
{
  id: 11,
  comments: [
 {}, ...