Skip to content

Instantly share code, notes, and snippets.

@danielmoi
danielmoi / 0-README.md
Created July 7, 2021 11:52 — forked from abhijeetchopra/0-README.md
Creating automatic scheduled backup copies of your Google Sheets using Google Apps Script

How to "Schedule Automatic Backups" of your Google Sheets

This tutorial demonstrates how to use Google Apps Script to:

  • Create copies of the Google Sheet in the desired destination folder automatically at set intervals.

  • Append the time stamp with each backup file's name.

  • Adjust time trigger for backing up every day/hour/minute.

Tables

Header 1 Header 2 Header 3 Header 4
Yeah Nah 1337 Pew pew pew
Yeah Nah 1337 Pew pew pew
@danielmoi
danielmoi / switch-local-git-clone-to-fork.md
Last active February 10, 2018 00:30
Switch a cloned repo into a fork

If you are like me you find yourself cloning a repo, making some proposed changes and then deciding to later contributing back using the GitHub Flow convention. Below is a set of instructions I've developed for myself on how to deal with this scenario and an explanation of why it matters based on jagregory's gist.

Proper GitHub flow is this:

  1. upstream = the original (forked) repo
  2. origin = my fork
@danielmoi
danielmoi / gist:fee740971d73b81b509f0eab4084abd9
Created February 28, 2017 22:02 — forked from guilherme/gist:9604324
Git pre-commit hook that detects if the developer forget to remove all the javascript console.log before commit.
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
# enable user input
exec < /dev/tty
consoleregexp='console.log'
# CHECK
if test $(git diff --cached | grep $consoleregexp | wc -l) != 0
then
@danielmoi
danielmoi / connect.js
Created February 13, 2017 18:55 — forked from gaearon/connect.js
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (

Enzyme tips

Mount or Shallow?

Testing component life cycle methods, like componentDidMount?

  • use mount and provide store

Testing state / props / clicks?

  • use shallow

Testing nested child components?

@danielmoi
danielmoi / git-gpg.md
Last active December 22, 2016 21:50 — forked from bcomnes/git-gpg.md
my version of gpg on the mac
  1. brew install gnupg2 pinentry-mac (this includes gpg-agent and pinentry)

  2. Generate a key: $ gpg2 --gen-key

  3. Take the defaults. Whatevs

  4. Tell gpg-agent to use pinentry-mac:

    $ vim ~/.gnupg/gpg-agent.conf 
    
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };