Skip to content

Instantly share code, notes, and snippets.

View hansamlin's full-sized avatar
🎯
Focusing

Sam Lin hansamlin

🎯
Focusing
View GitHub Profile
@hansamlin
hansamlin / strip
Created January 6, 2021 06:08
Remove html tag via js
function strip(html){
let doc = new DOMParser().parseFromString(html, 'text/html');
return doc.body.textContent || "";
}
@hansamlin
hansamlin / nginx conf
Created December 3, 2020 08:26
filter sql query
set $block_sql_injections 0;
if ($query_string ~* "(select|concat|case|sleep|md5|count\()") {
set $block_sql_injections 1;
}
if ($query_string ~* "\(case") {
set $block_sql_injections 1;
}
server {
listen 3000;
charset utf-8;
error_page 404 500 /404.html;
location / {
rewrite ^(.+)/$ $1 permanent;
index index.html;
root /my/project/path;
@hansamlin
hansamlin / search.css
Last active October 2, 2023 08:58
Google custom search by react.js
#search {
margin: auto;
}
#search-container {
width: 500px;
height: 300px;
margin: auto;
}