Skip to content

Instantly share code, notes, and snippets.

View zmalltalker's full-sized avatar

Marius Mathiesen zmalltalker

View GitHub Profile
<HTML>
<HEAD>
</HEAD>
<BODY>
<TABLE WIDTH="100%" HEIGHT="100%" STYLE="BACKGROUND-COLOR:BLUE">
<TR>
<TD VALIGN="MIDDLE" ALIGN="CENTER">
YO
</TD>
</TR>
<html>
<head>
</head>
<body>
<table width="100%" height="100%" style="background-color:blue">
<tr>
<td valign="middle" align="center">
Yo
</td>
</tr>
@zmalltalker
zmalltalker / android.xml
Created April 26, 2017 08:23
SVG from Sketch to Android
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="31dp"
android:height="183dp"
android:viewportWidth="31"
android:viewportHeight="183">
<path
android:fillColor="#902e2e"
android:pathData="M0 0h31v183H0z " />
type User struct {
CreatedAt time.Time `json:"created_at,string"`
UpdatedAt time.Time `json:"updated_at,string"`
FirstName string `json:"first_name,string"`
LastName string `json:"last_name,string"`
}
data = "{…json…}"
var u User
err := json.Unmarshal(data, &u)
class AppConfiguration
def self.configure(env)
raise "Neeed access token to work" unless env["TOKEN"]
self.access_token=env["TOKEN"]
end
def self.access_token=(token)
@access_token = token
end
def self.access_token

Must learn technology for any programmer

  • A functional language. Either Elixir or Clojure
  • A non-SQL database. Bonus points for Riak or Datomic
  • A non-bash shell
  • The UNIX process model: fork/exec
  • Sockets: create a socket and accept on it. Bonus points for netcat
  • A text editor
  • Git. At least git rebase -i
  • Encodings
require "./test_helper"
class PasswordResetTest < ActionDispatch::IntegrationTest
with_user("a@b.c", "oldpassword") do |user|
assert_response(200) { user.visits_profile_page }
assert_response(400) { user.resets_password_to(nil) }
assert_response(200) { user_resets_password_to("newpassword") }
end
end

OMG

Oh well. Let's see

class Person
attr_accessor :name
end
class FooController < ApplicationController
create_endpoint = swagger_method :create do |create|
create.summary "List all the Foos"
create.header :auth, :"X-AUTH-TOKEN", :required
create.param :new_foo, {name: String, address: {zip: String, city: String}}
end
def index
query = create_endpoint.parse(request)
auth_header = query.header[:auth]
@zmalltalker
zmalltalker / gist:5900206
Last active November 3, 2016 12:59
Install ruby-install, chruby and ruby 1.9.3 on Centos - Install puppet - Run `puppet apply <(curl -S https://gist.github.com/zmalltalker/5900206/raw/b9d7c2263cef981a8384a4e2b513e67c70060436/gistfile1.pp)`
# chruby
# ruby-install
# ruby 1.9.3
# /etc/profile.d/chruby.sh
Exec {
path => ["/bin","/usr/bin", "/usr/local/bin"]
}
file { "/etc/profile.d/chruby.sh":
ensure => present,