Skip to content

Instantly share code, notes, and snippets.

@mrsum
mrsum / store.js
Last active October 2, 2019 07:55
store.js
// Depends
import React, { useState, useReducer, useEffect, useContext } from "react";
// Define Store and initialState
const Store = React.createContext(null);
// Store Provider
export function StoreProvider({ children, reducer, initialState }) {
const [store, dispatch] = useReducer(reducer, initialState);
const [state, setState] = useState({ isLoaded: false });
@mrsum
mrsum / google-images.sh
Created June 28, 2017 15:12
google-images.sh
#!/bin/bash
COUNTER=1000
while [ $COUNTER -lt 2000 ]; do
wget "https://earthview.withgoogle.com/download/$COUNTER.jpg"
let COUNTER=COUNTER+1
done
var index, promise, _i;
for (index = _i = 0; _i < 10; index = ++_i) {
promise = (function(index) {
var dfd;
dfd = new $.Deferred();
setTimeout(function() {
log(index);
return dfd.resolve();