Skip to content

Instantly share code, notes, and snippets.

@gamerlv
gamerlv / notes.md
Last active December 10, 2015 08:28
This is an simple stripped down example of how I would like to see an python ORM ( Or query builder, if that's closer to this ). No need for an exact copy, just something close would do.

My main point I need are:

  • Models need to be classes, instancesable and have either a save function or something like database.insert(model)
  • Column need to be acceble in a varible fasion: model.column (eg person.firstname)
  • Models need to beable to have custom methods

I've already looked at:

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy import Column, String, Integer, create_engine
Base = declarative_base()
class Ban(Base):
__tablename__="ab_list"
id = Column(Integer, primary_key=True )
@gamerlv
gamerlv / crontab
Last active September 26, 2019 23:49
*/5 * * * * service multicraft sync
.header-nav-main {
text-align:center;
}
.header-nav-main .header-nav-item {
float:none;
display:inline-block;
}
root@nas:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdc2 1.7G 1.6G 68M 96% /
<p>Test bestand voor aeriscraft php test</p>
<br />
<?php
session_start();
echo "<pre>";
var_dump(session_save_path(), is_writable(session_save_path()), $_SESSION);
echo "</pre>";
echo "<form><input type='text' name='testfield'/><input type='submit'/></form>";
<?php
/*
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@gamerlv
gamerlv / gist:a42ec958580f8a7e6913
Last active August 29, 2015 14:05
Generated using ```xgettext --from-code=utf-8 -k__ -kline -o testing.pot $(find . -name "*.php")```
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#: application/core/MY_Lang.php:55 system/core/Lang.php:143
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
@gamerlv
gamerlv / gist:4eb901e375f49219477b
Created January 3, 2015 21:07
Little drop in example, Out of the top of my head but should work
//Any element with a class of voteBtn will trigger this, it can ba a button, a <a>, a <div> you name it
//As long as it has the data attribute
$('.voteBtn').click(function(e){
var $that = $(this);
$.post('/url/where/data/is/sendTo.php', {category_id: $that.data('category-id')}, function(data){
if (data.result){ //data needs to be valid json: {result: true}
$that.text("Voted!").attr('disabled', 'disabled');
} else {
#!/bin/bash
# Call like: startServer.sh jarfile minmem maxmem serverdir
# EG: startServer.sh /path/to/file.jar 1024 4096 /path/to/multicraft/server1234
# mulicraft conf: startServer.sh {JAR} {START_MEMORY} {MAX_MEMORY} {SERVER_DIR}
START_MEMORY=$2;
MAX_MEMORY=$3;
JAR=$1;
SERVER_DIR=$4;