Skip to content

Instantly share code, notes, and snippets.

Avatar

Wanlin Lin WanLinLin

  • Snapask
  • Taipei, Taiwan
View GitHub Profile
@WanLinLin
WanLinLin / google-ad-manager-ad-unit.jsx
Last active Jul 5, 2020
Google Ad Manager Ad Unit React Component
View google-ad-manager-ad-unit.jsx
import React from 'react'
import PropTypes from 'prop-types'
const GOOGLE_AD_MANAGER_ID = 'YOUR_ID'
/**
* It's used to generate ad element id. Make sure:
* - only increment it ONCE per component
* - only modify it on browser, not on server side
*/
@WanLinLin
WanLinLin / index.html
Last active Jul 5, 2020
Recaptcha React Component
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>React Recaptcha Example</title>
</head>
<body>
<script>
function onRecaptchaLoaded() {
@WanLinLin
WanLinLin / append_query_to_url.py
Created Jun 20, 2019
Merge query to url (python 2.7.13)
View append_query_to_url.py
import urlparse
def merge_query_to_url(url, query):
"""Merge query into url without any url encode/decode."""
url_parts = urlparse.urlparse(url)
# convert existing query string to dict
#
# Not using `urlparse.parse_qs` to extract existing query from url because
# it will convert url's query to utf8 string if it's url encoded