Skip to content

Instantly share code, notes, and snippets.

View raidenz's full-sized avatar

raidenz raidenz

View GitHub Profile
@raidenz
raidenz / windowsBootableUsbFromMac
Last active April 12, 2020 06:14
create usb bootable windows from mac
diksutil list
# change number wit your usb
diskutil eraseDisk MS-DOS "{usbName}" MBR disk{number}
# open iso files
ls /Volumes
# try to use -Rp instead
cp -Rp /Volumes/{OsIsoName}/* /Volumes/{usbName}/
@raidenz
raidenz / HomepageLayout.tsx
Created December 12, 2019 15:54
HomepageLayout with typescript
import * as React from "react";
import { Route, RouteProps } from "react-router";
interface Props {
component: React.ComponentType<RouteProps>;
}
export const HomepageLayout = ({ component: Component, ...rest }: Props) => {
return (
<Route {...rest} render={routeProps => <Component {...routeProps} />} />
);
@raidenz
raidenz / DumbComponent.jsx
Last active August 18, 2018 07:04
:medium: Dumb Compenent
import React from 'react'
const Name = (props) => {
return(
<div>
dumb Component
<div>
name: {props.name}
</div>
<input name="name" value={props.name} onChange={props.handleChange}/>
@raidenz
raidenz / SmartComponent.jsx
Last active August 18, 2018 07:06
:medium: smart component
import React from 'react'
class Statefull extends React.Component {
constructor(props){
super(props)
this.state={
name: ''
}
}
handleChange = (e) => {
@raidenz
raidenz / componenttype.txt
Last active August 18, 2018 06:56
:medium: react component type
╔════════════════╦═══════════════════╗
║ smart componen ║ dumb component ║
╠════════════════╬═══════════════════╣
║ statefull ║ Stateless ║
╠════════════════╬═══════════════════╣
║ container ║ functional ║
╚════════════════╩═══════════════════╝
@raidenz
raidenz / README.md
Created February 21, 2018 02:47
Sequelize + Express + Migrations + Seed Starter
@raidenz
raidenz / tager.sh
Last active December 14, 2019 20:43
ceate tool for git tag
#!/bin/bash
#get highest tag number
VERSION=`git describe --abbrev=0 --tags`
# get version from node
# PACKAGE_VERSION=$(node -p -e "require('./package.json').version")
#replace . with space so can split into an array
VERSION_BITS=(${VERSION//./ })
@raidenz
raidenz / express-server-side-rendering.md
Created May 6, 2017 16:30 — forked from joepie91/express-server-side-rendering.md
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
@raidenz
raidenz / sync.js
Created May 1, 2017 16:41
coroutines
var co = require('co');
var proc = require('child_process')
function exec(command) {
var p = new Promise(function (resolve, reject) {
proc.exec(command, function (err, stdout, stderr) {
if (err) {
console.log(stderr);
} else {
console.log(stdout)
@raidenz
raidenz / README.md
Created April 22, 2017 11:30 — forked from Dr-Nikson/README.md
Auth example (react + redux + react-router)