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 Calculator = ({ onResult }) => { | |
| const router = useRouter(); | |
| const { bondId } = router.query; | |
| // дублирование состояния из адресной строки | |
| const [selectedBondId, setSelectedBondId] = useState(bondId); | |
| const onSubmit = async () => { |
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 showWatchers() { | |
| var root = $(document.getElementsByTagName('body')); | |
| var watchers = []; | |
| var f = function (element) { | |
| if (element.data().hasOwnProperty('$scope')) { | |
| angular.forEach(element.data().$scope.$$watchers, function (watcher) { | |
| watchers.push(watcher); | |
| }); | |
| } |
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 applyMixins(derivedCtor: any, baseCtors: any[]) { | |
| baseCtors.forEach(baseCtor => { | |
| Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => { | |
| derivedCtor.prototype[name] = baseCtor.prototype[name]; | |
| }); | |
| }); | |
| } | |
| class ConstructorMixin { | |
| c: number; |
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/bash | |
| for path in `find $1 -type f | grep .json` | |
| do | |
| echo ${path} | |
| cat ${path} | python -m json.tool | grep $2 | |
| done |
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
| Program HelloWorld(output); | |
| const n = 30; | |
| var i : integer; | |
| l : integer; | |
| ar : array [1..n] of integer; | |
| max : integer; | |
| begin | |
| ar[1] := -1; | |
| ar[2] := -2; | |
| ar[3] := -3; |
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
| # task1440.py | |
| n = int(raw_input('')) | |
| scores = raw_input('') | |
| scores = [ int(x) for x in scores.split(' ') if x ] | |
| max1 = max(scores[0], scores[1]) | |
| max2 = min(scores[0], scores[1]) | |
| for i in xrange(2, len(scores)): | |
| if scores[i] > max1: |
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 contextlib import contextmanager | |
| from fabric.api import local, settings, abort, run, cd, env, prefix | |
| PROJECT_DIR = '~/path-to-ptoject' | |
| env.user = 'user' | |
| env.hosts = ['host.ru'] | |
| @contextmanager | |
| def virtualenv(): | |
| with prefix('source %s/envi/bin/activate' % PROJECT_DIR): |