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
| //======================================= | |
| // CHECK TC ID = | |
| //======================================= | |
| var checkTcNum = function(value) { | |
| value = value.toString(); | |
| var isEleven = /^[0-9]{11}$/.test(value); | |
| var totalX = 0; | |
| for (var i = 0; i < 10; i++) { | |
| totalX += Number(value.substr(i, 1)); | |
| } |
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
| /*** | |
| * Class DfTypedEnum | |
| * | |
| * http://stackoverflow.com/a/15010599/287084 | |
| * | |
| */ | |
| abstract class TypedEnum | |
| { | |
| /** @var array cache of all enum instances by class name and integer value */ |
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 scrollToElement(selector) { | |
| var $elem = $(selector); | |
| if ($elem.length == 0) { | |
| return; | |
| } | |
| var offsetTop = $elem.offset().top; | |
| $('html,body').animate({ | |
| "scrollTop": offsetTop |
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
| CREATE TABLE `vergi_daireleri` ( | |
| `id` int(10) unsigned NOT NULL AUTO_INCREMENT, | |
| `plaka` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, | |
| `il` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, | |
| `ilce` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, | |
| `daire` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci | |
| INSERT INTO vergi_daireleri (id, plaka, il, ilce, daire) VALUES (1, '01', 'ADANA', 'Merkez', '5 Ocak Vergi Dairesi Müdürlüğü'); |
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
| // Part of https://github.com/chris-rock/node-crypto-examples | |
| // Nodejs encryption with CTR | |
| var crypto = require('crypto'), | |
| algorithm = 'aes-256-ctr', | |
| password = 'd6F3Efeq'; | |
| function encrypt(text){ | |
| var cipher = crypto.createCipher(algorithm,password) | |
| var crypted = cipher.update(text,'utf8','hex') |
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 | |
| require_once 'recipe/common.php'; | |
| server('production', 'server ip', 'port (optional)') | |
| ->user('deploy') | |
| ->path('Path'); | |
| set('shared_dirs',['app/storage']); | |
| set('shared_files',[]); |
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
| # post_loc.txt contains the json you want to post | |
| # -p means to POST it | |
| # -H adds an Auth header (could be Basic or Token) | |
| # -T sets the Content-Type | |
| # -c is concurrent clients | |
| # -n is the number of requests to run in the test | |
| ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/ |
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
| var isoCountries = { | |
| 'AF' : 'Afghanistan', | |
| 'AX' : 'Aland Islands', | |
| 'AL' : 'Albania', | |
| 'DZ' : 'Algeria', | |
| 'AS' : 'American Samoa', | |
| 'AD' : 'Andorra', | |
| 'AO' : 'Angola', | |
| 'AI' : 'Anguilla', | |
| 'AQ' : 'Antarctica', |
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 detailed comments and demo, see my SO answer here http://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional/21915381#21915381 | |
| /* a helper to execute an IF statement with any expression | |
| USAGE: | |
| -- Yes you NEED to properly escape the string literals, or just alternate single and double quotes | |
| -- to access any global function or property you should use window.functionName() instead of just functionName() | |
| -- this example assumes you passed this context to your handlebars template( {name: 'Sam', age: '20' } ), notice age is a string, just for so I can demo parseInt later | |
| <p> | |
| {{#xif " name == 'Sam' && age === '12' " }} | |
| BOOM |
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
| weblab@devbox:~/projects$ grunt --version | |
| grunt-cli v0.1.11 | |
| weblab@devbox:~/projects$ yo --version | |
| 1.0.4 | |
| weblab@devbox:~/projects/closure-test$ node --version | |
| v0.8.26 | |
| weblab@devbox:~/projects/closure-test$ npm --version |