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
| expect(x).toEqual(y); compares objects or primitives x and y and passes if they are equivalent | |
| expect(x).toBe(y); compares objects or primitives x and y and passes if they are the same object | |
| expect(x).toMatch(pattern); compares x to string or regular expression pattern and passes if they match | |
| expect(x).toBeDefined(); passes if x is not undefined | |
| expect(x).toBeUndefined(); passes if x is undefined |
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
| q + (1234567890) | |
| => start record | |
| q | |
| => stop | |
| @(1234567890) | |
| => play | |
| :reg |
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
| grep [PATTERN] [FILE] | |
| grep apple fruitlist.txt | |
| grep apple *.txt | |
| grep ^app fruitlist.txt | |
| "-x :: exact line | |
| grep -x apple fruitlist.txt |
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
| 200 OK OK | |
| 201 CREATED Created | |
| 204 DELETED No Content [1] | |
| 400 BAD_REQUEST Bad Request | |
| 401 FORBIDDEN Unauthorized [2] | |
| 404 NOT_FOUND Not Found | |
| 409 DUPLICATE_ENTRY Conflict [3] | |
| 410 NOT_HERE Gone [4] | |
| 501 NOT_IMPLEMENTED Not Implemented | |
| 503 THROTTLED Service Unavailable [5] |
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
| assertEqual(a, b) #a == b | |
| assertNotEqual(a, b) #a != b | |
| assertTrue(x) #bool(x) is True | |
| assertFalse(x) #bool(x) is False | |
| assertIs(a, b) #a is b 2.7 | |
| assertIsNot(a, b) #a is not b 2.7 | |
| assertIsNone(x) #x is None 2.7 | |
| assertIsNotNone(x) #x is not None 2.7 | |
| assertIn(a, b) #a in b 2.7 | |
| assertNotIn(a, b) #a not in b 2.7 |
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
| #Quick Cheat Sheet | |
| T.delay(arg, kwarg=value) | |
| #always a shortcut to .apply_async. | |
| T.apply_async((arg, ), {'kwarg': value}) | |
| T.apply_async(countdown=10) | |
| #executes 10 seconds from now. |
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
| HANDY ONE-LINE SCRIPTS FOR AWK 30 April 2008 | |
| Compiled by Eric Pement - eric [at] pement.org version 0.27 | |
| Latest version of this file (in English) is usually at: | |
| http://www.pement.org/awk/awk1line.txt | |
| This file will also be available in other languages: | |
| Chinese - http://ximix.org/translation/awk1line_zh-CN.txt | |
| USAGE: |
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
| getAlgorithms = -> ['md5', 'sha1', 'sha256', 'sha512'] | |
| generateCode = (url, algorithms, digits, callback)-> | |
| #increase code digits if all codes are registered | |
| if algorithms.length is 0 | |
| algorithms = getAlgorithms() | |
| digits += 1 | |
| algorithm = algorithms.shift() |
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
| 1. set user | |
| useradd -ms /bin/bash [username] | |
| passwd [username] | |
| hostname [NEW_NAME] | |
| 2. login in new user, install packages: | |
| sudo apt-get install apache2 php5 php5-mysql libapache2-mod-php5 apache2-mpm-prefork | |
| sudo apt-get install mysql-server mysql-client |
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
| reader = new FileReader() | |
| reader.onloadend = => | |
| reader.result | |
| reader.readAsDataURL event.target.files[0] | |
| reader = new FileReader() | |
| reader.onloadend = => | |
| $(event.target).prev('.image').attr 'src', reader.result |