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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
all_dbs=”$(mysql -h $DB_HOST -u $DB_USER -p$DB_PASS -e ‘show databases;’)” | |
for db in $all_dbs | |
do | |
if test $db != “mysql” && [[ $db == *$db_filter* ]] | |
then sql=$(mysql -h $DB_HOST -u $DB_USER -p$DB_PASS -e “SET @DATABASE_NAME=’$db’; SELECT CONCAT(‘ALTER TABLE ‘, table_name,’ ENGINE=\’InnoDB\’;’) AS ‘’ FROM information_schema.tables AS tb WHERE table_schema = @DATABASE_NAME AND ENGINE=’MyISAM’ ORDER BY table_name DESC;”) && | |
mysql -h $DB_HOST $db -u $DB_USER -p$DB_PASS -e “$sql” | |
fi | |
done |
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
"""Filter CSV""" | |
import csv | |
import time | |
PASS_FILTER = ['Value A', | |
'Value B'] | |
FILENAME = 'Filename' | |
EXTENSION = 'csv' | |
ORIGINAL_FILENAME = FILENAME + '.' + EXTENSION |
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
/** | |
* Utility function to capitalize the keys of an object recursively | |
* @param {Object} obj The object to capitalize the keys for | |
* @return {Object} The provided object with capitalized keys | |
*/ | |
const capitalizeKeys = obj => { | |
return Object.keys(obj).reduce((acc, key) => { | |
const capitalizedKey = `${key.charAt(0).toUpperCase()}${key.slice(1)}` | |
if (typeof obj[key] !== 'object') { |
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 React from "react"; | |
import ReactDOM from "react-dom"; | |
import "./styles.css"; | |
function App() { | |
return ( | |
<div className="App"> | |
<h1>Hello CodeSandbox</h1> | |
<h2>Start editing to see some magic happen!</h2> |
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 React from "react"; | |
import ReactDOM from "react-dom"; | |
import { useSpring, animated } from "react-spring"; | |
import "./styles.css"; | |
function App() { | |
const [props, set] = useSpring(() => ({ left: 0 })); | |
return ( | |
<div className="App"> |
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 React, { useState } from "react"; | |
import ReactDOM from "react-dom"; | |
import { useSpring, animated } from "react-spring"; | |
import "./styles.css"; | |
function App() { | |
const [toggle, setToggle] = useState(false); | |
const [props, set] = useSpring(() => ({ left: 0 })); | |
return ( |
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
{ | |
"name": "dynamic-routing", | |
"version": 2, | |
"builds": [{ "src": "next.config.js", "use": "@now/next" }], | |
"routes": [ | |
{ "src": "/", "dest": "/index" }, | |
{ | |
"src": "/_next/static/(?:[^/]+/pages|chunks|runtime)/.+", | |
"headers": { "cache-control": "immutable,max-age=31536000" } | |
} |
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
{ | |
"name": "dynamic-routing", | |
"version": 2, | |
"builds": [{ "src": "next.config.js", "use": "@now/next" }], | |
"routes": [ | |
{ "src": "/", "dest": "/index" }, | |
{ "src": "/(?<slug>[^/]+)", "dest": "/post?slug=$slug" }, | |
{ | |
"src": "/_next/static/(?:[^/]+/pages|chunks|runtime)/.+", | |
"headers": { "cache-control": "immutable,max-age=31536000" } |
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
// pages/post.js | |
import React from 'react'; | |
const Post = ({ slug }) => <div>{slug}</div>; | |
Post.getInitialProps = async ({ query }) => { | |
const { slug } = query; | |
return { |
OlderNewer