Skip to content

Instantly share code, notes, and snippets.

View PavelPenkov's full-sized avatar

Pavel Penkov PavelPenkov

  • InSales
  • Moscow, Russia
View GitHub Profile
public interface IValidate
{
IList<string> Errors { get; }
}
partial class Book : IValidate
{
public IList<string> Errors
{
get
public interface IValidate
{
IList<string> Errors { get; }
}
partial class Book : IValidate
{
public IList<string> Errors
{
get
n.times do |i|
puts i
end
import urllib2, sys, re
from urllib import urlencode
params = [('pol', 2), ('spol', 2), ('foto', 1), ('a', 'search')]
expr = re.compile('page.*"')
for s in urllib2.urlopen('http://loveplanet.ru/a-search', urlencode(params)):
#if expr.match(s):
print s
//было
//index.html
function getUserInfo(id) {
$.post(<%= Html.Url("User", "Info") %>, id, ...);
}
...
u1 = getUserInfo(1);
u2 = getUserInfo(2);
from urllib2 import urlopen
import HTMLParser
class MyParser(HTMLParser.HTMLParser):
def handle_starttag(self, tag, attrs):
pass
def handle_data(self, data):
print data
<html>
<body>
<script type="text/javascript" src="jquery-1.5.js"></script>
<script type="text/javascript">
function zhopa() {
alert('zhopa');
}
</script>
<script type="text/javascript">
$(function() {
set :application, "OohForYou"
set :repository, "/Users/synapse/projects/OohForYou"
set :scm, :mercurial
set :deploy_to, '/u/domains/ooh4you.net'
set :deploy_via, :copy
role :web, "89.185.229.183" # Your HTTP server, Apache/etc
role :app, "89.185.229.183"
role :db, "89.185.229.183", :primary => true
<html>
<body>
<script type="text/javascript" src="jquery-1.5.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.10.custom.min.js" ></script>
<script type="text/javascript">
$(function() {
var f = 'zhopa';
var g = function() { alert('Nothing to do'); };
$('#btn1').click(function() {
f = function() { alert('Job done'); };
Array.prototype.map2 = function(f) {
return fold([], SynLib.append.combine(f));
}
Function.prototype.combine = function(g) {
return function() { this(g(arguments)) };
}
var SynLib = {
append: function(array, x) {