This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/socket.h> | |
#include <arpa/inet.h> | |
#include <unistd.h> | |
int main(void) { | |
struct sockaddr_in server_address; /* address of the server */ | |
int client_socket; /* FD of socket to connect with servers */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An usual class is a subclass of object | |
class Human(object): | |
# Defining class variables | |
species = "H. Sapiens" | |
def __init__(self, first_name, last_name): | |
# Assign instance variables (also called attributes): | |
self.__internal = "secret" # Private attribute (externally accessed via: human._Human_internal) | |
self.first_name = first_name # Public attribute (externally accessed via human.first_name) | |
self.last_name = last_name # Since last_name has not a getter/setter below |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM elixir:1.10.4 | |
## | |
# Install system dependencies & tooling | |
## | |
RUN apt-get update | |
RUN apt-get -y upgrade | |
RUN apt-get install -y bash curl apt-utils build-essential inotify-tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 1. Create a sample table to store our bookings: | |
*/ | |
> CREATE TABLE bookings (id INT, scheduled_date DATE, start_time TIMESTAMP, end_time TIMESTAMP, timezone_id VARCHAR(40)) | |
> \d bookings | |
-- +----------------+-----------------------------+-------------+ | |
-- | Column | Type | Modifiers | | |
-- |----------------+-----------------------------+-------------| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Implementation | |
## | |
# config/config.exs | |
config :my_app, :kv_store_adapter, KVStore | |
defmodule KVStore do | |
#... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configuration for Alacritty, the GPU enhanced terminal emulator. | |
# Any items in the `env` entry below will be added as | |
# environment variables. Some entries may override variables | |
# set by alacritty itself. | |
# env: | |
# TERM variable | |
# | |
# This value is used to set the `$TERM` environment variable for | |
# each instance of Alacritty. If it is not present, alacritty will |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Account do | |
defstruct name: nil, amount: 0 | |
def start(%Account{} = account) do | |
spawn fn -> run(account) end | |
end | |
defp run(account) do | |
account = receive do | |
{:debit, value} -> %{account | amount: account.amount - value} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Query { | |
allPersons(last: Int): [Person!]! | |
} | |
type Mutation { | |
createPerson(name: String!, age: Int!): Person! | |
} | |
type Subscription { | |
newPerson: Person! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.2.3 | |
MAINTAINER tiagopog@gmail.com | |
# Install apt based dependencies required to run Rails as | |
# well as RubyGems. As the Ruby image itself is based on a | |
# Debian image, we use apt-get to install those. | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
nodejs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateFoo < ActiveRecord::Migration[5.0] | |
def change | |
create_table(:foos, force: true) do |t| | |
t.text :message, null: false | |
t.datetime :created_at, null: false | |
end | |
end | |
end |
NewerOlder