Skip to content

Instantly share code, notes, and snippets.

@ecthiender
ecthiender / tmux-session-init.sh
Created March 27, 2013 12:28
Tmux session initiation script: creates a new tmux session or attaches to an existing one.
#!/bin/sh
# tmux session initialisation script
# change the following config to your preferences
SESSION="work"
workspace1="$HOME/server/www"
workspace2="$HOME/codeyard"
tmux has-session -t $SESSION > /dev/null
var Timer;
Timer = (function() {
function Timer(opts) {
this.opts = opts != null ? opts : {};
_(this).extend(Backbone.Events);
_.defaults(this.opts, {
start: 0
});
@ecthiender
ecthiender / virtual-labs-dataservice-entities.py
Created August 20, 2015 04:31
[SQLAlchemy Models] Entities in the Virtual Labs dataservice
class IntegrationLevel(db.Model):
__tablename__ = 'integration_levels'
id = db.Column(db.Integer, primary_key=True)
level = db.Column(db.Integer, nullable=False)
labs = db.relationship('Lab', backref='integration_level')
class TypeOfLab(db.Model):
__tablename__ = 'type_of_labs'
@ecthiender
ecthiender / citrus_1.py
Created September 10, 2015 22:11
Some limey functions!
# -*- coding: utf8 -*-
# Some limey functions!
from functools import reduce
import itertools
import unittest
def omit(x, li):
@ecthiender
ecthiender / main.hs
Created August 30, 2017 18:59 — forked from thsutton/main.hs
Monad logger
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Applicative
import Control.Monad.Except
import Control.Monad.IO.Class ()
import Control.Monad.Reader
@ecthiender
ecthiender / hge-blog-update-mutations-schema.sql
Last active August 13, 2018 06:12
Sample schema for update mutations
CREATE TABLE author (
id INTEGER PRIMARY KEY,
name TEXT
);
CREATE TABLE article (
id INTEGER PRIMARY KEY,
title TEXT,
content TEXT,
author_id INTEGER,
@ecthiender
ecthiender / hge-blog-generated-update-mutations.graphql
Last active August 13, 2018 06:23
Generated update mutations by HGE
update_author(
_inc: author_inc_input
_set: author_set_input
where: author_bool_exp!
): author_mutation_response
author_set_input {
id: Int
name: String
}
mutation update_title_content {
update_article(
where: {id: {_eq: 1}},
_set: {
title: "John's new first post title",
content: "New content for John's first post"
}
) {
affected_rows
returning {
mutation update_likes {
update_article(
where: {id: {_eq: 1}},
_inc: {likes: 1}
) {
affected_rows
returning {
id
likes
}
mutation update_drafts {
update_article(
where: {author: {name: {_eq: "John"}}},
_set: {is_published: true}
) {
affected_rows
}
}