-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4f4651
commit 9f51769
Showing
11 changed files
with
181 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<title>frames</title> | ||
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script> | ||
<script type="text/javascript"> | ||
$(document).ready(function(){ | ||
$('#frmSite').load(function(){ | ||
$("#frmSite").contents().find("#item2").css("background-color","#BADA55"); | ||
console.log("lala"); | ||
}); | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<iframe src="file:///home/stanislavfeldman/projects/samples/html/tree.html" width="600" height="400" id='frmSite'></iframe> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
console.log("hi"); | ||
var x = 7; | ||
function sum(a, b) | ||
{ | ||
console.log(arguments); | ||
console.log(arguments.callee); | ||
return a+b; | ||
} | ||
console.log(sum(3, 5)); | ||
function fac(num) | ||
{ | ||
if(num <= 1) | ||
return 1; | ||
else | ||
return num * fac(num-1); | ||
} | ||
console.log(fac(99)); | ||
var calc = { | ||
op1: 555, | ||
op2: 5, | ||
sum: function() { return this.op1 + this.op2; } | ||
} | ||
console.log(calc.sum()); | ||
console.log(calc.sum.call({op1: 4, op2:7})); | ||
function get_func(x) | ||
{ | ||
var y = 0; | ||
y += x; | ||
return function() { return y; } | ||
} | ||
console.log(get_func(1)()); | ||
console.log(get_func(2)()); | ||
uid = (function() | ||
{ | ||
var id = 0; | ||
return function() { return id++; } | ||
})(); | ||
console.log(uid()); | ||
console.log(uid()); | ||
|
||
function Rect(w, h) | ||
{ | ||
this.w = w; | ||
this.h = h; | ||
} | ||
Rect.prototype.area = function() { return this.w*this.h; } | ||
|
||
r = new Rect(5,6); | ||
console.log(r.area()); | ||
console.log(r.hasOwnProperty("area")); | ||
|
||
function PosRect(x, y, w, h) | ||
{ | ||
Rect.call(this, w, h); | ||
this.x = x; | ||
this.y = y; | ||
} | ||
PosRect.prototype = new Rect(); | ||
delete PosRect.prototype.w; | ||
delete PosRect.prototype.h; | ||
PosRect.prototype.constructor = PosRect; | ||
PosRect.prototype.contains = function(x, y) | ||
{ | ||
return (x > this.x && x < this.x + this.w && y > this.y && y < this.y + this.h); | ||
} | ||
|
||
pr = new PosRect(2, 2, 4, 4); | ||
console.log(pr.contains(3,3)); | ||
console.log(pr.area()); | ||
console.log(Object.prototype.toString.apply(pr)); |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from kiss.views.templates import TemplateResponse | ||
from kiss.controllers.core import Controller | ||
from kiss.core.application import Application | ||
|
||
|
||
class Controller1: | ||
def get(self, request): | ||
return TemplateResponse("view.html", { "foo": "bar", "users": [{"url": "google.com", "username": "brin"}] }) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from settings import options | ||
from kiss.core.application import Application | ||
|
||
|
||
app = Application(options) | ||
app.start() | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from os import path | ||
current_dir = path.dirname(path.abspath(__file__)) | ||
import sys | ||
sys.path.append("/home/stanislavfeldman/projects/python/kiss.py") | ||
sys.path.append("/home/stanislavfeldman/projects/python/compressinja/") | ||
sys.path.append("/home/stanislavfeldman/projects/python/putils/") | ||
sys.path.append("/home/stanislavfeldman/projects/python/pev/") | ||
from kiss.core.application import Application | ||
from controllers.controller1 import Controller1 | ||
|
||
|
||
options = { | ||
"urls": { | ||
"": Controller1 | ||
}, | ||
"views": { | ||
"templates_path": "views.templates", | ||
"static_path": "views.static", | ||
"templates_extensions": ["views.extensions.Simple"], | ||
} | ||
} | ||
|
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from jinja2.ext import Extension | ||
from jinja2 import nodes | ||
from jinja2 import Markup | ||
|
||
class Simple(Extension): | ||
tags = set(["simple"]) | ||
|
||
def parse(self, parser): | ||
stream = parser.stream | ||
tag_token = stream.next() | ||
arg_token = stream.next() | ||
arg = nodes.Const(arg_token.value, lineno=arg_token.lineno) | ||
return nodes.Output([self.call_method('_render', [arg])]).set_lineno(tag_token.lineno) | ||
|
||
def _render(self, arg): | ||
return Markup("<h1>Simple tag with arg: %s</h1>" % arg) |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<html> | ||
<head> | ||
<title>цукцк</title> | ||
</head> | ||
<body> | ||
<div>{{ foo }}</div> | ||
<div>{% simple "lala" %}</div> | ||
<ul> | ||
{% for user in users %} | ||
<li><a href="{{ user.url }}">{{ user.username }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
x = 555 | ||
puts "hi, num: #{x}" | ||
def f(name) | ||
puts "hello, #{name}" | ||
end | ||
f("stas") | ||
class Greeter | ||
def initialize(name="world") | ||
@name = name | ||
end | ||
def hi(name=nil) | ||
if name.nil? | ||
name = @name | ||
end | ||
puts "hi, #{name}" | ||
end | ||
end | ||
g = Greeter.new("sam") | ||
class Greeter | ||
attr_accessor :name | ||
end | ||
g.hi("boris") | ||
g.name = "sammm" | ||
puts g.name |