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
| <?php | |
| class Model{ | |
| protected $id = null; | |
| public function setId($id){ | |
| $this->id = $id; | |
| } | |
| public function getId(){ | |
| return $this->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
| #!/usr/bin/env python | |
| from selenium import webdriver | |
| browser = webdriver.Firefox() | |
| browser.get('http://lenta.ru/') | |
| browser.save_screenshot('screenie.png') | |
| browser.close() |
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
| #!/bin/sh | |
| prefix="/tmp/mail/sendmail/new" | |
| numPath="/tmp/mail/sendmail" | |
| if [ ! -f $numPath/num ]; then | |
| echo "0" > $numPath/num | |
| fi | |
| num=`cat $numPath/num` | |
| num=$(($num + 1)) | |
| echo $num > $numPath/num |
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
| #! /bin/sh | |
| CURRENT_DIR=/home/andrey/projects/current | |
| PROJECT_DIR=/home/andrey/projects | |
| PROJECT=$1 | |
| DIR=$2 | |
| rm $CURRENT_DIR/$PROJECT | |
| ln -s $PROJECT_DIR/$DIR $CURRENT_DIR/$PROJEC |
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
| ls -lah | grep %filename%*.xml | awk '{print $9}' | xargs grep -c '%close tag%' | awk '{i = split($0,a,":"); print a['2']}' | awk '{s+=$1}END{print s}' |
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
| VIRTUAL_ENV="$(cd "$(dirname "${BASH_SOURCE:-0}")/.."; pwd)" |
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 struct import pack, unpack, calcsize | |
| import cStringIO | |
| def sphinx_unpack(fmt, fp): | |
| return unpack(fmt, fp.read(calcsize(fmt))) | |
| def parse_query_result(data, query_count): | |
| data = cStringIO.StringIO(data) | |
| result = [] |
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
| <?php | |
| class BlogMapper extends AbstractMapper | |
| { | |
| protected $tableName = 'blog'; | |
| protected $fieldIdName = 'blog_id'; | |
| public function FindByName ($name) | |
| { | |
| $sql = sprintf('SELECT * FROM `blog` WHERE `blog_name` =%s LIMIT 1', $this->db->quot($name)); | |
| $row = $this->db->sqlparse($sql); | |
| return ($row) ? $this->CreateFromRow($row[0]) : false; |
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 operator import mul | |
| x = [1,2,4,0,5,0] | |
| x_mul = reduce(mul, [ y for y in x if y]) | |
| count_nil = x.count(0) | |
| if count_nil == 1: | |
| print [ (0 if y != 0 else x_mul) for y in x] | |
| elif count_nil >= 2: |
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
| # base | |
| set -g set-titles on | |
| set -g set-titles-string "#H > #W" | |
| # automatically set window title | |
| setw -g automatic-rename | |
| set -g base-index 1 | |
| set -g history-limit 5000 |
OlderNewer