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
#search { | |
margin: auto; | |
} | |
#search-container { | |
width: 500px; | |
height: 300px; | |
margin: auto; | |
} |
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
server { | |
listen 3000; | |
charset utf-8; | |
error_page 404 500 /404.html; | |
location / { | |
rewrite ^(.+)/$ $1 permanent; | |
index index.html; | |
root /my/project/path; |
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
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; | |
} |
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 strip(html){ | |
let doc = new DOMParser().parseFromString(html, 'text/html'); | |
return doc.body.textContent || ""; | |
} |
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 bubbleSort(arr) { | |
for(var i = 0; i < arr.length; i++) { | |
if(arr[i] > arr[i + 1]) { | |
var tmp = arr[i + 1]; | |
arr[i + 1] = arr[i]; | |
arr[i] = tmp; | |
} | |
} |
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
# Note (November 2016): | |
# This config is rather outdated and left here for historical reasons, please refer to prerender.io for the latest setup information | |
# Serving static html to Googlebot is now considered bad practice as you should be using the escaped fragment crawling protocol | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name yourserver.com; | |
root /path/to/your/htdocs; |
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
// Set an error message and redirect | |
var redirectWithMessage = function (message, url, req, res) { | |
req.session.messages = message; | |
res.redirect(url); | |
}; | |
// Return 'messages' value or null instead | |
var getMessages = function (req) { | |
var messages = req.session.messages || null; | |
delete req.session.messages; |
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
import { useEffect } from 'react' | |
import Script from 'next/script' | |
import { useRouter } from 'next/router' | |
import * as gtag from './gtag' | |
const App = ({ Component, pageProps }) => { | |
const router = useRouter() | |
useEffect(() => { | |
const handleRouteChange = (url) => { | |
gtag.pageview(url) |
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 getArrayBuffer(file) { | |
return new Promise((resolve, reject) => { | |
const reader = new FileReader(); | |
reader.addEventListener('load', () => { | |
resolve(reader.result); | |
}); | |
reader.addEventListener('error', () => { | |
reject(); | |
}); |
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 _get(obj, path, _default) { | |
if (typeof obj !== "object") { | |
throw new Error("param 1 must be an object") | |
} | |
if (typeof path !== "string" && !Array.isArray(path)) { | |
throw new Error("param 2 must be an object or a string") | |
} | |
let _path = path |
OlderNewer