Skip to content

Instantly share code, notes, and snippets.

@zelid
zelid / utils.py
Created May 19, 2012 14:37
Allow to create new model with related models in Flask-Peewee API call
def get_models_from_dictionary(model, field_dict):
if isinstance(model, Model):
model_instance = model
check_fks = True
else:
model_instance = model()
check_fks = False
models = [model_instance]
for field_name, value in field_dict.items():
field_obj = model._meta.fields[field_name]
public class Question
{
public int Id { get; set; }
public string Name { get; set; }
public List<Answer> Answers { get; set; }
public List<Comment> Comments { get; set; }
}
public class Answer
{
Post["/question"] = parameters =>
{
Question question = this.Bind();
return View["question.html", question];
};
<form action="/question" method="post">
<ul>
<li>
<input type="text" name="Name" value="Question Name" />
<input type="text" name="Id" value="1" />
</li>
<li>
<ul>
<li>
<input type="text" name="Answers[0].Name" value="Answer 1 Name" />
<form action="/question" method="post">
<ul>
<li>
<input type="text" name="Name" value="Question Name" />
<input type="text" name="Id" value="1" />
</li>
<li>
<ul>
<li>
<input type="text" name="Question[Answers][0].Name" value="Answer 1 Name" />
import wx
import win32api
import win32gui
import win32con
from sciter import sapi
from sciter.capi.scdef import *
@zelid
zelid / test-image.html
Last active September 24, 2017 17:20
Strange IMG behaviour
<html>
<head>
<title></title>
<style>
body {
/* background-color: #404552; */
/* border-color: #404552; */
}
!
! Comments begin with a "!" character.
!
XTerm*background: black
XTerm*foreground: white
XTerm*cursorColor: white
XTerm*VT100.geometry: 80x25
! XTerm*faceName: Terminus:style=Regular:size=10
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Targets in ths file are to take a V8 context snapshot on build time.
# Created V8 context snapshot is used in
# third_party/WebKit/Source/bindings/core/v8/V8ContextSnapshot.{cpp|h}.
# to speedup creating a V8 context and setting up around it.
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
@zelid
zelid / gist:8e96bf90d428ba514cc8b200ae53bc5f
Created May 30, 2019 21:46
E:\dev\nw\src\content\nw\patch\patches\buildtools.patch
diff --git a/third_party/libc++/BUILD.gn b/third_party/libc++/BUILD.gn
index 9bcd072..bb61518 100644
--- third_party/libc++/BUILD.gn
+++ third_party/libc++/BUILD.gn
@@ -21,7 +21,11 @@ config("config") {
if (libcxx_is_shared) {
_libcxx_target_type = "shared_library"
} else {
- _libcxx_target_type = "source_set"
+ if (is_linux) {