Skip to content

Instantly share code, notes, and snippets.

View marlo22's full-sized avatar

Marcin Lasecki marlo22

View GitHub Profile
@marlo22
marlo22 / index.js
Last active April 14, 2021 15:33
WinRegistry
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const regedit_1 = __importDefault(require("regedit"));
const os_1 = __importDefault(require("os"));
const architecture = os_1.default.arch();
const path = architecture === 'x64' ? 'HKLM\\Software\\Wow6432Node\\Google\\Chrome\\Extensions\\kjjmmomgbglgdjaecbakemnmhoeebndj' : 'HKLM\Software\Google\Chrome\Extensions\kjjmmomgbglgdjaecbakemnmhoeebndj';
// regedit.list('HKLM\\Software\\Wow6432Node\\Google\\Chrome\\', (err, result) => {
@marlo22
marlo22 / index.js
Last active March 27, 2021 10:54
Chrome checker
process.env.EXTENSION_ID=ciffhdfhcbhceoebcokbfgjbgpanldkj
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const os_1 = __importDefault(require("os"));
const { homedir: userDir } = os_1.default.userInfo();
const { platform } = process;
@marlo22
marlo22 / mount
Created August 9, 2019 10:51
Enzyme wrappers
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`App snapshot 1`] = `
<App>
<div
className="app"
>
<Counter
onDecrement={[Function]}
onIncrement={[Function]}
@marlo22
marlo22 / index.jsx
Created July 19, 2019 08:26
JSX to plain object
<div className="search-box">
<label for="search">Wyszukaj:</label>
<input type="text" id="search" placeholder="Wyszukaj..." />
</div>
@marlo22
marlo22 / index.js
Last active July 5, 2019 12:53
reference
class Parent extends Component {
methodFromChild = () => null;
getMethodForMe = method => {
this.methodFromChild = method;
}
render() {
return <Child setFunctionReference={this.getMethodForMe} />
}
@marlo22
marlo22 / 0_action.js
Last active July 2, 2019 11:56
Promise
export default getWeather = city => new Promise((resolve, reject) => {
// Wysyłamy zapytanie do jakiegoś API o pogodę na dzisiaj
axios.get(`http://weather.api.com/today/${city}`)
.then(response => {
// ...czekamy aż serwer odeśle odpowiedź
// ...jeszcze chwilka i...
// JEST!
console.log(response) // { temp: 26, weather: 'sunny' }
// Skoro mamy już odpowiedź to możemy oznajmić wszystkim zainteresowanym, że nasz Promise jest resolved.