Skip to content

Instantly share code, notes, and snippets.

import React, { useCallback, useEffect, useState } from 'react'
import CircularProgress from 'material-ui/CircularProgress'
import { useDropzone } from 'react-dropzone'
import cx from '../../helpers/classname'
import './drop-zone.scss'
const useProgress = (initial = { current: 0, total: 1 }) => {
const [{ current, total }, setProgress] = useState(initial)
return [
@danieldogeanu
danieldogeanu / RenameGitBranch.md
Last active June 11, 2024 12:27
How to rename your Git master branch to main.

To rename your Git master branch to main, you must do the following steps:

  1. Navigate to your repository in the command line and issue the following commands: - git branch -m master main - git push -u origin main

  2. Change your default branch on GitHub by going to your GitHub repository in your browser, and navigate to Settings > Branches and click on the dropdown and switch from master to main and click Update (this will only show if you have two or more branches). The main branch is now your default branch.

  3. Update the tracking of the branch from your command line with the following command: - git branch -u origin/main main

@ahacke
ahacke / Exiftool Cheats (for Synology Photostation).md
Last active July 28, 2023 02:15
Contains exiftool cheats and tricks, mostly used for Synology Photostation

Exiftool Cheats (for Synology Photostation).md

Contains scripts to modify exif metadata on media files. Generally, I used them for the synology photostation.

Another good reference with exif tricks: https://gist.github.com/rjames86/33b9af12548adf091a26

All of the commands or scripts require ExifTool by Phil Harvey.

Recommended Order of Running the Commands and Scripts

  1. Set CreateDate for Video-Media
  2. Set 'CreateDate' Based on FileName Supporting Different Formats
#!/bin/bash
# Run this script just before you put the laptop in the bin for security scanning.
# You can add the seconds the laptop will be waiting before speaking. The default
# is waiting for 180 seconds (3 minutes).
# Switch to the login screen, effectively locking the screen.
function lockscreen() {
/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend
}
@johnwesonga
johnwesonga / AppDispatcher.js
Created October 27, 2014 18:26
React+Flux App
/**
*
*
* AppDispatcher
**/
var Dispatcher = require('flux').Dispatcher;
var copyProperties = require('react/lib/copyProperties');
var AppDispatcher = copyProperties(new Dispatcher(), {
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active June 22, 2024 03:44
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

mylib.close_to_tray = ->
gui = require('nw.gui')
win = gui.Window.get()
tray = null
win.on 'close', ->
this.hide()
tray = new gui.Tray({ icon: 'icon.jpg' })
@b1rdex
b1rdex / is-focused.js
Created February 25, 2014 05:48
node-webkit window.isFocused emulation
(function() {
window.frame = require("nw.gui").Window.get();
window.frame.isFocused = true;
var windowFocusHandler = function() {
window.frame.isFocused = true;
}
, windowBlurHandler = function() {
window.frame.isFocused = false;
@TheDistantSea
TheDistantSea / version_compare.js
Created December 18, 2013 12:19
Function to compare two version strings (e.g. "1.6.1" is smaller than "1.7"). Developed in order to answer http://stackoverflow.com/a/6832721/50079.
/**
* Compares two software version numbers (e.g. "1.7.1" or "1.2b").
*
* This function was born in http://stackoverflow.com/a/6832721.
*
* @param {string} v1 The first version to be compared.
* @param {string} v2 The second version to be compared.
* @param {object} [options] Optional flags that affect comparison behavior:
* <ul>
* <li>