Skip to content

Instantly share code, notes, and snippets.

View nicolasdao's full-sized avatar

Nicolas Dao nicolasdao

View GitHub Profile
@nicolasdao
nicolasdao / gas_html_sidebar_template_demo.html
Last active March 29, 2021 15:23
html code that demos various forms to interact with your Google Docs. Build with jQuery, jQuery UI, jQuery Validation, spin.js and Google Apps Script CSS style guide
<!DOCTYPE html>
<html>
<head>
<!-- Used by Google Apps Script to use with iFrame (ref. https://developers.google.com/apps-script/migration/iframe) -->
<base target="_top">
<!-- Google Apps Script CCS STyle Guide (ref. https://developers.google.com/apps-script/add-ons/css) -->
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
<!-- jQuery UI ThemeRoller (ref. http://jqueryui.com/themeroller/) - e.g. needed for calendar -->
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/themes/smoothness/jquery-ui.css">
@nicolasdao
nicolasdao / gcp_get_ip_range.sh
Last active October 9, 2019 16:17
GCP does not explicitly expose its IP range. If you have a GCP system and a 3rd party that only accept connection from a set of whitelisted IPs, connecting your GCP system to that 3rd party will require to get your hands on the IP range.
# Run this command to get the latest IP range:
dig @8.8.8.8 +short txt _cloud-netblocks.googleusercontent.com | sed 's/"//g; s/ip4://g; s/ip6://g;' | tr ' ' '\n' | grep include | cut -d ':' -f2 | xargs dig @8.8.8.8 +short txt | sed 's/"//g; s/ip4://g; s/ip6://g;' | tr ' ' '\n' | grep '/'
# The following list got extracted on 20170418:
# 8.34.208.0/20 IP range: 8.34.208.0 8.34.223.255
# 8.35.192.0/21 IP range: 8.35.192.0 8.35.199.255
# 8.35.200.0/23 IP range: 8.35.200.0 8.35.201.255
# 108.59.80.0/20 IP range: 108.59.80.0 108.59.95.255
# 108.170.192.0/20 IP range: 108.170.192.0 108.170.207.255
# 108.170.208.0/21 IP range: 108.170.208.0 108.170.215.255
# 108.170.216.0/22 IP range: 108.170.216.0 108.170.219.255
@nicolasdao
nicolasdao / open_source_licenses.md
Last active June 29, 2024 18:45
What you need to know to choose an open source license.
@nicolasdao
nicolasdao / js_regex_cheatsheet.md
Last active March 19, 2024 11:31
My most common JS RegEx. Just sick of restarting from scratch each time I need a freaking RegEx. Keywords: regex regexp regular expression rege reg
// src/schema.js
const { makeExecutableSchema } = require('graphql-tools')
const _ = require('lodash')
const schema = `
type Product {
id: ID!
name: String!
shortDescription: String
- src/
|__ graphql/
|__ product/
| |__ schema.graphql
| |__ resolver.js
|
|__ variant/
|__ schema.graphql
|__ resolver.js
// src/graphql/product/schema.graphql
type Product {
id: ID!
name: String!
shortDescription: String
}
type Query {
# ### GET products
const schema = `
type Teacher {
id: ID!
creationDate: String
firstname: String!
middlename: String
lastname: String!
age: Int!
gender: String
const schema = `
type Node {
id: ID!
creationDate: String
}
type Person inherits Node {
firstname: String!
middlename: String
lastname: String!
const schema = `
type Teacher {
id: ID!
creationDate: String
firstname: String!
middlename: String
lastname: String!
age: Int!
gender: String
title: String!