Skip to content

Instantly share code, notes, and snippets.

View landongn's full-sized avatar
🎧
Code Yoter

Landon Noss landongn

🎧
Code Yoter
View GitHub Profile
# !/usr/bin/env python3
#
# libtcod python tutorial
#
import math
import shelve
import textwrap
import libtcodpy as libtcod
wget --no-check-certificate -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -
echo 'deb http://debian.neo4j.org/repo stable/' | sudo tee /etc/apt/sources.list.d/neo4j.list
sudo apt update
sudo apt install neo4j
sudo service neo4j start
@landongn
landongn / gist:d73e62a107159bd37c07a5e114e911ce
Created June 7, 2018 18:12 — forked from luckydev/gist:b2a6ebe793aeacf50ff15331fb3b519d
Increate max no of open files limit in Ubuntu 16.04 for Nginx
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Perspective</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module">
import { html, render } from 'https://unpkg.com/lit-html/lib/lit-extended.js?module';
defmodule Server.SessionPlug do
@behaviour Plug
import Plug.Conn
require Logger
def init(opts), do: opts
def call(conn, _) do
Logger.info "SessionPlug: Looking for session for player"
require Logger
alias Server.Repo
alias Server.Character
defmodule Server.World do
@online %{}
def join(character) do
online = Map.put @online, character.id, character
Logger.info "character #{inspect character.name} has come online"
def new_character(struct, params \\ %{}) do
struct
|> cast(params, [:name, :player_id, :class_id])
|> validate_required([:name, :class_id, :player_id])
|> cast_assoc(:class, required: true)
|> cast_assoc(:player, required: true)
end
** (Ecto.QueryError) the binding used in `from` must be selected in `select` when using `preload` in query:
from c in Server.Character,
where: c.player_id == ^...,
select: {c.name, c.id, c.class_id, c.experience, c.gold, c.level, c.weapon_id, c.armor_id, c.health, c.defense},
preload: [:class, :weapon, :armor]
defmodule Server.CharacterChannel do
use Server.Web, :channel
alias Phoenix.View
alias Server.CharacterView
alias Server.Repo
alias Server.Player
alias Server.Character
alias Ecto.Query
import Ember from 'ember';
export default Ember.Component.extend({
currentUsername: '',
currentSecret: '',
dataService: Ember.inject.service(),
actions: {
updateUsername() {