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>
@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]
class Controller
def self.create_friend_request(user, params)
obj = Model.new(params)
if obj.valid?
render json: obj, status: :created
else
render json: obj.errors, status: 400
end
unless Rails.env.development? || Rails.env.test?
# Interesting variables:
# - $COLUMNS: how wide are we?
# - $SECONDS: how long have we been running
# %#: root will have #, others will have %
autoload -U colors
setopt prompt_subst