Skip to content

Instantly share code, notes, and snippets.

@haintwork
haintwork / react-specialization.jsx
Created July 29, 2017 10:27
React Specialization
function Dialog(props) {
return (
<FancyBorder color="blue">
<h1 className="Dialog-title">
{props.title}
</h1>
<p className="Dialog-message">
{props.message}
</p>
{props.children}
@haintwork
haintwork / react-composition-component.jsx
Last active August 5, 2017 00:06
Composition Component
<div>
<div className="SplitPane-left">
{props.left}
</div>
<div className="SplitPane-right">
{props.right}
</div>
</div>
function App() {
@haintwork
haintwork / react-form-multiple-input.jsx
Created July 29, 2017 10:04
Handle Form Multiple Inputs in React
class Reservation extends React.Component {
constructor(props) {
super(props);
this.state = {
isGoing: true,
numberOfGuests: 2
};
this.handleInputChange = this.handleInputChange.bind(this);
}
@haintwork
haintwork / app.jsx
Created July 28, 2017 14:19
export/import/using component
import React, { Component } from 'react';
import Hello from './Hello';
import logo from './logo.svg';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
@haintwork
haintwork / protractor-notes.md
Last active July 24, 2017 07:57
Protractor Notes

Locator

Basic locator:

  • By ID:
element(by.id('buttonId')).click();
  • By model:
element(by.model('user.loginName')).sendKeys('admin');//input field
@haintwork
haintwork / install-protractor-proxy.md
Created July 19, 2017 11:29
install protractor via command line with proxy settings
webdriver-manager update --proxy=http://"username":"password"@hostname:8080
@haintwork
haintwork / java-date-add-subtract.md
Last active July 17, 2017 11:30
How to subtract X day from a Date object in Java?
@haintwork
haintwork / java-using-enumerated-jpa.md
Last active November 2, 2017 07:29
[Using @Enumerated(EnumType.STRING) in JPA] #jpa #hibernate
@haintwork
haintwork / ordinal-to-enum.md
Created July 12, 2017 08:27
Convert an ordinal into its enum represantation

To convert an ordinal into its enum represantation you might want to do this:

ReportTypeEnum value = ReportTypeEnum.values()[ordinal];

Please notice the array bounds.

Note that every call to values() returns a newly cloned array which might impact performance in a negative way. You may want to cache the array if it's going to be called often.

Reference: https://stackoverflow.com/questions/609860/convert-from-enum-ordinal-to-enum-type

@haintwork
haintwork / common-printer-commands.md
Last active July 5, 2017 10:39
Common Printer commands

Set default printer

RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /y /n "printer"

Export/Import Printer setting (can be used for updating paper size)

Export:

RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Ss /n "printer" /a "C:\A4-format.dat"

Import: