This file contains hidden or 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
function pages_bar($current_page, $pages_num, $sef, $script_name) { | |
$pages_bar=''; | |
if($current_page>1) { | |
$back_page=$current_page-1; | |
if($sef==0) $pages_bar.= "<a href=\"".$script_name."?page=".$back_page."\">íàçàä</a> ← "; | |
else $pages_bar.= "<a href=\"".$script_name."".$back_page."\">íàçàä</a> ← "; | |
} | |
for($i=1; $i<=$pages_num; $i++) { | |
if($i==$current_page){ | |
$pages_bar.= "<span>".$i."</span> "; |
This file contains hidden or 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
require 'google/api_client' | |
client = Google::APIClient.new | |
translate = client.discovered_api('translate', 'v2') | |
client.authorization.access_token = '123' # dummy | |
client.key = "my-key-example" # your key from Google API console | |
response = client.execute( | |
:api_method => translate.translations.list, |
This file contains hidden or 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
FinnishTools.Views.Videos ||= {} | |
class FinnishTools.Views.Videos.IndexView extends Backbone.View | |
template: JST["backbone/templates/videos/index"] | |
events: | |
"click .pagination ul li" : "changePage" | |
initialize: -> | |
_.bindAll(this, 'addOne', 'addAll', 'render') |
This file contains hidden or 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
.pagination | |
ul | |
- if(currentPage > 1) | |
li.prev | |
a(href="#")= "← Назад" | |
- else | |
li.prev.disabled | |
a(href="#")= "← Назад" | |
each page in pages | |
li |
This file contains hidden or 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
for i:=1 to n do | |
begin | |
for i2 := 1 to d do if a[i] = b[i2] then FlagFound := true else begin FlagFound := false; c:=1 end; | |
if flagfound = false then for i1 := (i + 1) to n do if a[i] = a[i1] then c := c + 1; | |
if (c > 2) and (FlagFound = false) then begin b[d + 1] := a[i]; d := d + 1; c := 0; end else c :=0; | |
end; |
This file contains hidden or 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
#encoding: utf-8 | |
module Modules | |
module FinnishNumbers | |
def self.convert_to_s(number) | |
number = number.to_i | |
return "nolla" if number.zero? | |
number_symbols = number.to_s.split('').map { |digit| digit.to_i } | |
digits = "", "yksi", "kaksi", "kolme", "neljä", "viisi", "kuusi", "seitsemän", "kahdeksan", "yhdeksän", "kymmenen" | |
if number <= 10 | |
digits[number_symbols[0]] |
This file contains hidden or 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
kirill@kirill-HP-Compaq-8200-Elite-CMT-PC:~$ ruby skype.rb | |
-> SEARCH CHATS | |
<- | |
<- CONNSTATUS ONLINE | |
<- CURRENTUSERHANDLE k.shatrov | |
<- USERSTATUS ONLINE | |
<- CHATS #balbekov_oleg/$divineforest;f3dd4c870a518c6e, #dima-exe/$balbekov_oleg;560e7335511ecfd4, #divineforest/$designer_bondarev;fc54e05c01216297, #balbekov_oleg/$listictac;4e017bd4cadbb3ef, #kill2joy/$k.shatrov;68abbfd6b65055f9, #k.shatrov/$navigator-edu;17558b4692d9577f, #balbekov_oleg/$gvgstv;b21f86c264af2c95, #a.ognevsky/$antiarchitect;ee38ba658fc0109, #balbekov_oleg/$quallianleion;ee416b18a68e540, #finist.rus/$balbekov_oleg;e6248c70d918cafb | |
#<Rype::Chat:0xb73c83c4 @chatname="#balbekov_oleg/$divineforest;f3dd4c870a518c6e"> | |
#<Rype::Chat:0xb73c83b0 @chatname="#dima-exe/$balbekov_oleg;560e7335511ecfd4"> | |
#<Rype::Chat:0xb73c839c @chatname="#divineforest/$designer_bondarev;fc54e05c01216297"> |
This file contains hidden or 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
module Modules | |
module FnordmetricEvent | |
class << self | |
def create(*options) | |
define_api | |
event_key = options[0] | |
raise "Pass the event key" unless event_key.present? | |
params = options[1] | |
if params |
This file contains hidden or 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
function ror_id(jObjOrString) { | |
var matchResult; | |
if ( isJQ(jObjOrString) ) { | |
var id = jObjOrString.data('ror_id'); | |
if ( ! isset(id) ) { | |
id = jObjOrString.attr('id'); | |
if ( isset(id) ) { | |
matchResult = id.match($.regexp.rorId); | |
id = matchResult ? matchResult[2] : ''; | |
jObjOrString.data('ror_id', id); |
This file contains hidden or 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
from django.db import models | |
class Post(models.Model): | |
title = models.CharField(max_length=40) | |
content = models.TextField() | |
def __unicode__(self): | |
return self.title | |
class Comment(models.Model): |