This file contains 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
{ | |
"env": { | |
"browser": true, | |
"es6": true, | |
"node": true | |
}, | |
"ecmaFeatures": { | |
"arrowFunctions": true, | |
"blockBindings": true, | |
"classes": true, |
This file contains 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 deasciifier = require('turkish-deasciifier'); | |
var deascii = new deasciifier(); | |
console.log(deascii.deasciify("Turkce guzel bir dildir.")); |
This file contains 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
;;; runs eslint --fix on the current file after save | |
;;; alpha quality -- use at your own risk | |
(defun eslint-fix-file () | |
(interactive) | |
(message "eslint --fixing the file" (buffer-file-name)) | |
(shell-command (concat "eslint --fix " (buffer-file-name)))) | |
(defun eslint-fix-file-and-revert () | |
(interactive) |
This file contains 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
Some Notes on Django and Celery Logging: | |
1. logging_tree is very useful. logging_tree.print_output() | |
2. Celery by defaults hijacks the logger, and overwrites its handler and formatter. | |
You can set it to not hijack, in which case the root logger will be preserved, except for its level. | |
The level of the root logger is still hijacked by the celery process. | |
3. Django has its own default logging, which is merged with our logging. To disable old logging, |
This file contains 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 DatabaseLoggingMiddleware(object): | |
def process_request(self, request): | |
request.start_time = time.time() | |
def process_response(self, request, response): | |
if 'content-type' in response._headers and response._headers['content-type'][1].startswith('application/json') and response.status_code == 200: | |
end_time = time.time() | |
total_execution_time_msec = int((end_time - request.start_time) * 1000) |
This file contains 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
[ignore] | |
.*/node_modules/fbjs/.* | |
.*/node_modules/flux/.* | |
.*/node_modules/npm/.* | |
.*/node_modules/babylon/.* | |
[options] | |
module.name_mapper='.*\(.less\)' -> 'empty/object' | |
module.name_mapper='.*\(.css\)' -> 'empty/object' | |
module.system.node.resolve_dirname=node_modules |
This file contains 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
//@flow | |
// define the function type | |
type FunctionThatTakesAStringAndReturnsANumber = (x: string) => number; | |
function higherOrderFunction(myFn: FunctionThatTakesAStringAndReturnsANumber) { | |
return "something"; | |
} |
This file contains 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 parse5spice(filename) | |
% PARSE5SPICE Parses the data in the Report tab of the 5Spice software and | |
% imports it into MATLAB workspace | |
% Call the function with an optional filename. If no filename is specified, | |
% a data.txt in the same directory is used. | |
% To create data.txt, right click in 5Spice in the Report tab, click Select | |
% All, and Copy and paste into an empty file. Then, save data as data.txt | |
% in the same directory |
This file contains 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
ag '^[ \t]+from ' questions | grep -v django | grep -v vendor | grep -v 'from questions' |
This file contains 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 MatchingViewFuncMiddleware(object): | |
def process_request(self, request): | |
pass | |
def process_response(self, request, response): | |
if 'content-type' in response._headers and \ | |
response._headers['content-type'][1].startswith('application/json') and \ | |
response.status_code == 200: |