Skip to content

Instantly share code, notes, and snippets.

View takahirohonda's full-sized avatar

Takahiro Honda takahirohonda

View GitHub Profile
@takahirohonda
takahirohonda / image-reformatter.py
Created May 3, 2020 03:15
image-reformatter.py
from PIL import Image
from resizeimage import resizeimage
# For square images
input_path_square_image = [
'./original/schedule-girl-1.PNG',
'./original/schedule-girl-2.PNG',
'./original/schedule-girl-3.PNG',
'./original/schedule-girl-4.PNG'
]
import requests, json, xmltodict
request_url = 'https://ws.ondemand.qas.com/ProOnDemand/V3/ProOnDemandService.asmx?WSDL='
qas_token = '<add your token>'
soap_action = 'http://www.qas.com/OnDemand-2011-03/DoSearch'
headers = {
'Content-Type':'text/xml',
'Auth-Token':qas_token,
'SOAPAction': soap_action
}
const axios = require('axios')
const parseString = require('xml2js').parseString
const qas_token = '<add your token>'
const soap_action = 'http://www.qas.com/OnDemand-2011-03/DoSearch'
const xml = '<?xml version="1.0" encoding="UTF-8" ?> \
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ond="http://www.qas.com/OnDemand-2011-03">\
<soapenv:Header>\
<ond:QAQueryHeader />\
</soapenv:Header>\
@takahirohonda
takahirohonda / solor-synonym-map-field-to-field-type.xml
Created March 27, 2020 00:24
solor-synonym-map-field-to-field-type.xml
<fields>
<field
name="productname_s"
type="productnamemanualsynonyms"
indexed="true"
stored="true"/>
...
@takahirohonda
takahirohonda / solor-synonym-add-field-type.xml
Created March 27, 2020 00:21
solor-synonym-add-field-type.xml
<fieldType name="productnamemanualsynonyms"
class="solr.TextField"
positionIncrementGap="500"
sortMissingLast="true">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.TrimFilterFactory"/>
<filter class="solr.SynonymFilterFactory"
expand="true"
ignoreCase="true"
@takahirohonda
takahirohonda / schema-solr-synonym.xml
Created March 27, 2020 00:15
schema.xml for Solr synonym
<?xml version="1.0" encoding="utf-8"?>
<schema name="example" version="1.5">
<fields>
<field name="productname_s" type="productnamemanualsynonyms" indexed="true" stored="true"/>
<field name="productcode_t" type="productcodemanualsynonyms" indexed="true" stored="true"/>
<field name="productcategory_sm" type="productcategorymanualsynonyms" indexed="true" stored="true"/>
<field name="_content" type="text_general" indexed="true" stored="false" />
<field name="_database" type="string" indexed="true" stored="true" />
<field name="_path" type="string" indexed="true" stored="true" multiValued="true" />
<field name="_uniqueid" type="string" indexed="true" stored="true" required="true" />
@takahirohonda
takahirohonda / FirstOrDefault_vs_Where.cs
Last active February 28, 2020 12:02
FirstOrDefault_vs_Where.cs
using System;
using System.Collections.Generic;
using System.Linq;
public class FirstOrDefaultOrWhere
{
public static MyModel GetModel()
{
List<MyModel> modelList = new List<MyModel>
{
@takahirohonda
takahirohonda / this-keyword-example.js
Created February 10, 2020 03:47
this-keyword-example.js
var a = 'global';
var check = {
a: 'hello',
b: function() {
console.log(this.a);
},
c: function() {
setTimeout(function(){
// this becomes global because setTimeout's call site is global
@takahirohonda
takahirohonda / selenium-python-example.py
Last active January 31, 2020 08:41
selenium-python-example.py
# run test > py.test --html=report.html registerPage.py
import pytest
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
@takahirohonda
takahirohonda / svg-sizing-not-working-for-iphone-2.html
Created January 31, 2020 07:24
svg-sizing-not-working-for-iphone-2.html
<!-- add class name and css -->
<img
src="img/logo.svg"
alt="My Logo"
class="my-logo-svg">
<style>
.my-logo-svg {
width: 250px;
height: 94px;