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
def myFunc(arg1, arg2): | |
result = arg1 + arg2 | |
return result | |
print(myFunc(2, 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
{ test: /\/src\/api.js$/, loader: StringReplacePlugin.replace({ | |
replacements: [ | |
{ | |
pattern: /@apiUrl@/ig, | |
replacement: function (match, p1, offset, string) { | |
return myUrls[process.env.NODE_ENV]; | |
} | |
} | |
]}) | |
} |
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
<div class="row search-select-group"> | |
<div class="search-select" | |
ng-class="{'col-xs-12': !ajs.allowClear, 'col-xs-11': ajs.allowClear}"> | |
<ui-select ng-model="ajs.model" append-to-body="true"> | |
<ui-select-match allow-clear="ajs.allowClear" | |
placeholder="{{ajs.placeholder}}"> | |
{{$select.selected[ajs.displayField]}} | |
</ui-select-match> | |
<ui-select-choices | |
repeat="objs[ajs.modelField] as obj in ajs.lookup | filter: $select.search" |
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
server { | |
listen 80; | |
root "/var/www/dev.kancolle.io/dist"; | |
server_name "dev.kancolle.io"; | |
location / { | |
try_files $uri /index.html; | |
} | |
} |
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
// App Run | |
$API.setHeader(`Content-Type`, `application/json`); | |
// Take One | |
const headers = new Map(); | |
headers[`Content-Type`] = `multipart/form-data`; | |
console.log(headers) | |
// Map{} Content-Type: `multipart/form-data`; | |
$API.post('UploadAvatar', formData, {headers}); | |
// Request Header: Content-Type: application/json; |
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
auth.singInWebapi = (user) => { | |
return new $q((resolve, reject) => { | |
const address = `${$API.url}Token`; | |
const request = new XMLHttpRequest; | |
const handleResponse = () => { | |
const { status } = request; | |
if (request.readyState === request.DONE) { | |
if (status > 0) { | |
const body = JSON.parse(request.response); |
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
if object_['landProperties']: | |
if object_['landProperties']['landscapeType']: | |
if 'landtype' in object_['landProperties']['landscapeType']: | |
if object_['landProperties']['landscapeType']['landtype']: | |
if isinstance(object_['landProperties']['landscapeType']['landtype'], str): | |
object_['landProperties']['landscapeType']['landtype'] = \ | |
object_['landProperties']['landscapeType']['landtype'].split(',') | |
object_['landProperties']['landscapeType'] = ", ".join([ | |
self.dictionary['land_type'][land_type].lower() | |
for land_type in object_['landProperties']['landscapeType']['landtype'] |
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
{ | |
"type": "object", | |
"properties": { | |
"mainPhoto": {"type": "string"}, | |
"propertyType": {"type": "string"}, | |
"price": { | |
"type": "object", | |
"properties": { | |
"USD": {"type": "number"}, | |
"RUB": {"type": "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
# Case One: How /it should be/ done: | |
class CloudStorageRaises(object): | |
def upload_picture(file): | |
try: | |
url = self.storageApi.upload_from_file(file).generate_url() | |
return url | |
except Exception as e: |
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 xml.etree import ElementTree as et | |
from xml.dom import minidom | |
""" | |
Convert Python dict to XML using a special set of rules | |
Function build_xml takes a specialy formatted dict and returns xml.etree.ElementTree Element. | |
1) There can be only one Root Element, it must be at a top-level of a dictionary and it should be the only element at | |
top-level | |
2) Keys are element names, key values should be dicts with element params. | |
3) If there should be more than one elements with the same name, key value could be a list of dicts with params. |