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
window.test = 'global test'; | |
(function () { | |
console.log(typeof test); // "undefined" | |
var test = 'context test'; | |
console.log(test); // "context test" | |
})(); | |
console.log(test); // "global test" |
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
# -*- coding: utf-8 -*- | |
'''Download ZIP archive with a MongoDB database, unpack it | |
and import it to the local MongoDB instance | |
Usage: python mongounzip.py | |
''' | |
import os | |
import os.path | |
import shutil | |
import subprocess | |
import sys |
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
# -*- coding: utf-8 -*- | |
'''Dump MongoDB databases to the zip archives | |
and copy its to the output folder. | |
Usage: python mongozip.py | |
''' | |
import os | |
import os.path | |
import datetime | |
import tempfile | |
import shutil |
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
# -*- coding: utf-8 -*- | |
import json | |
import requests | |
ASANA_API_URL = 'https://app.asana.com/api/1.0' | |
ASANA_AUTH = ('qhXkFMH.GSCXOSYJbKfOd2U26NqaQxNf', '') | |
PROJECTS = { | |
u'Лифт в будущее': { | |
'id': 1493261729734, |
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
param($url) | |
$webclient = new-object Net.WebClient | |
$webclient.Credentials = new-object Net.NetworkCredential("admin", "pass") | |
$webpage = $webclient.DownloadString($url) |
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
import requests | |
import json | |
REQ_FROMAT = 'json' | |
CHANNEL_REQ = 'http://vimeo.com/api/v2/channel/%s/%s.%s' | |
SAMPLE_CHANNEL = 'leeseidenbergadvertising' | |
CHANNEL_INFO = 'info' | |
CHANNEL_VIDEOS = 'videos' | |
FEED_PAGE_SIZE = 20 |
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
infile ="video.avi" | |
tmpfile="video_tmp.mp4" | |
outfile="video.mp4" | |
options="-vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 \ | |
-partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \ | |
-me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 \ | |
-flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 \ | |
-g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10\ | |
-qmax 51 -qdiff 4" |
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
public static string Case( | |
this int val, | |
string one, | |
string two, | |
string five) { | |
var t = (val % 100 > 20) ? val % 10 : val % 20; | |
switch (t) { | |
case 1: | |
return one; | |
case 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
from lxml import etree | |
with open('./sportobj.xsd') as f: | |
schema = etree.XMLSchema(etree.parse(f)) | |
with open('./sportobj-sample.xml') as f: | |
sample = etree.parse(f) | |
with open('./sportobj.xsl') as f: | |
transform = etree.XSLT(etree.parse(f)); |
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
const string cs = "<CONNECTION_STRING>"; | |
const string key = "<YANDEX_API_CODE>"; | |
const string requestUrlTemplate = | |
"http://geocode-maps.yandex.ru/1.x/" + | |
"?geocode={0}&key={1}&&results=1"; | |
var addresses = new List<string>(); | |
using (var connection = new SqlConnection(cs)) | |
using (var select = connection.CreateCommand()) | |
{ |