Skip to content

Instantly share code, notes, and snippets.

@cotyembry
cotyembry / doskey.md
Created December 14, 2016 00:22 — forked from vladikoff/doskey.md
Setup Persistent Aliases & Macros in Windows Command Prompt (cmd.exe) using DOSKey

Setup Persistent Aliases & Macros in Windows Command Prompt (cmd.exe) using DOSKey

Saved from Archive.org, Date: May 14, 2010 Author: Jesse Webb

http://web.archive.org/web/20140330024520/http://devblog.point2.com/2010/05/14/setup-persistent-aliases-macros-in-windows-command-prompt-cmd-exe-using-doskey/

Our development machines here at Point2 are not standardized; we have a mixture of Windows XP, 7, and Mac OSX/Unix computers. I find myself constantly switching back and forth between command prompt interfaces when pair programming. As a result, I catch myself using “ls” to list a directories contents regardless of what system I am on. I am currently using a Windows XP machine for my developer box and I wanted to setup an alias to the “ls” command to actually perform a “dir”. Here is how I accomplished it…

There is a command available in a Window’s shell that let’s you “alias” command to whatever you please: DOSKey. It allows you to create “macros” to execute one or more other commands with a custom nam

So I needed to unmount a volume (i.e. usb) from my macbook and the command to use is

hdiutil unmount -force /Volumes/{nameOfVolumeHere}

(without the {} characters)

To list the available volumes you can do

ls /Volumes/

...I think

Aliases in cmd.exe - This gist is about making the cmd.exe experience more custom

Below is the content of the file name that would be actually logonCommands.cmd

DOSKEY ls=dir
DOSKEY del=rm
DOSKEY c=cls
DOSKEY clear=cls
DOSKEY nrw=npm run webpack

DOSKEY nrs=npm run start

With a webpack-dev-server running on localhost on a computer you can connect to this content on another computer through the LAN (Local Area Network) using the wifi or even an Ethernet cable I suppose.

To do this when you start the dev server you have to specify some things (I did this in my package.json file and will start it using the npm run scripts feature)

"start": "webpack-dev-server --inline --port 8080 --host 192.168.0.12 --content-base ."

To know which port you want to set it up for you can do the following on Windows (you'll have to google 'how to find my ip add ress Linux or unix' for the command to get that information - sorry)

ipconfig
to create a persistent variable in windows cmd in the terminal/command prompt you can type
setx variableName value
Now variableName will be available in every cmd session after exiting out of the current cmd.exe session.
It is a persistent, how amazing.
to echo it, i.e. print it out, do
echo %variableName%
// Below is an example to incorrectly mutate the styles
var svgStyle = styles.svg;
svgStyle.width = this.state.width;
svgStyle.height = this.state.height;
// Below is a proper way to change the style that is used by cloning the style rather than mutating it
var svgStyle = {...styles.svg, width: this.state.width, height: this.state.height }
@cotyembry
cotyembry / uniqueKeyNChildReact.md
Created March 8, 2017 01:56
This shows an awesome way to manage unique keys with references uniquely identified
	this.Sections = [];
	//by using block scope introduced by let, I am able to pass a unique value to each different child, in order to uniquely identify them without any other dependencies
	for(let i = 1; i <= 4; i++) {
		this.Sections.push(
			<div style={styles.section} key={'parent_' + i} className='section'>
				<div style={styles.header} key={i} onClick={() => this._onClick(i)} className='header'></div>
			</div>
		)

}

@cotyembry
cotyembry / windowsCMDAliases.md
Created March 17, 2017 18:06
Windows Shortcut Cusomizer - This is how you can pass in a program and an argument for a shortcut on windows

C:\Windows\System32\cmd.exe /K C:\Users\johnembry\Developer\aliases\aliases.bat

@cotyembry
cotyembry / reactNativeGistSetup.md
Created March 19, 2017 08:22
My super quick overview of the steps I did tonight to get a fresh, up to date, react-native project setup
  1. create-react-native-app projectName
  2. pod init in the ios folder 2.1. add any pod files you want to ios/Podfile 2.2. pod install 2.2.1 sometimes this git repo doesnt download...you can google and find the .zip file for it and just take the .git file that is created and use it any synthetically create this stupid workaround... 2.2.2 pod install --no-update (or some modifier like that - sorry, this isnt exact...youre honestly lucky im taking the small amount of time to write what I'm writing)
  3. react-native link (something like that) to link the pod files
  4. create a workspace in xcode (if you need to write native code)
  5. drag the .xcodeproject (or whatever its called) to the newly created .wrkspace project
  6. from now on only use the .wrkspace project (this is because of the pod files have to be structured in the project directory as they are - you can read about it)
  1. install x-button mouse control
  2. set middle click (or any button you desire) to actually do a left button click
  3. go to the microsoft mouse and keyboard application
  4. set your desired gesture to trigger a middle click - or your custom action if you specified one in step 2. (x-button mouse control will override and do a normal click)

issues: -you lose a button since you are overriding one -tap and hold still doesn't work (i.e. drag and drop is still not functional)