Skip to content

Instantly share code, notes, and snippets.

View idlework's full-sized avatar
💭
@work for StaffTraveler

Johan Haneveld idlework

💭
@work for StaffTraveler
  • Freelance Senior web(app) Developer
  • Utrecht
  • 07:07 (UTC +02:00)
View GitHub Profile
@idlework
idlework / How-to Create-an–Android-Emulator-Via-Terminal
Created May 27, 2025 09:42
How to Create an Android Emulator Via Terminal
## Step-by-Step Guide
### Step 1: Install Java
Before proceeding, ensure that Java is installed on your system. If not, you can install it using Homebrew:
```bash
brew install openjdk@11
```
@idlework
idlework / test.js
Last active July 15, 2024 10:58
Gilded Rose with Javascript and Jest
describe("decreaseSellIn", function () {
it("should decrease the sellIn value by 1", function () {
const item = { name: "foo", sellIn: 5, quality: 10 };
const updatedItem = decreaseSellIn(item);
expect(updatedItem.sellIn).toBe(4);
});
it("should handle negative sellIn values correctly", function () {
const item = { name: "bar", sellIn: -1, quality: 8 };
const updatedItem = decreaseSellIn(item);
@idlework
idlework / how-to-add-changes-to-an-old-commit.md
Last active June 30, 2020 12:17
How to add changes to an old commit

Use git rebase, specifically:

  1. Use git stash to store the changes you want to add.
  2. Use git rebase -i HEAD~10 (or however many commits back you want to see).
  3. Mark the commit in question (a0865...) for edit by changing the word pick at the start of the line into edit. Don't delete the other lines as that would delete the commits.
  4. Save the rebase file, and git will drop back to the shell and wait for you to fix that commit.
  5. Pop the stash by using git stash pop
  6. Add your file with git add <file>.
  7. Amend the commit with git commit --amend --no-edit.
  8. Do a git rebase --continue which will rewrite the rest of your commits against the new one.
@idlework
idlework / setTimeoutPromise.ts
Created June 11, 2020 11:30
Resolved timeout promise
const setTimeoutPromise = (timeout: number, value: any) =>
new Promise((resolve) =>
setTimeout(() => {
resolve(value)
}, timeout)
)
@idlework
idlework / FloatingActionBar.js
Last active February 16, 2024 11:24
FloatingActionBar
import PropTypes from 'prop-types';
import React, {useState} from 'react';
import {StyleSheet, View} from 'react-native';
import FloatingActionButton from './FloatingActionButton';
import FloatingActionIndicator from './FloatingActionIndicator';
const FloatingActionBar = ({
distance,
items,
onPress,
@idlework
idlework / gist:1b1936da85597e3c8b57caaac605ba34
Last active November 13, 2021 02:43
Ducky one 2 mini - shortcuts
A small reference to remind me what the shortcuts are for my Ducky one 2 mini.
Profile shortcuts
Switch keyboard profile - Hold FN + Alt + {1-9}
Reset keyboard profile - Hold both windows keys for 3 seconds
Macro shortcuts for profile
Start profile macro - Hold FN + Alt + Tab for 3 seconds
Exit profile macro - Hold FN + Alt + Tab

Keybase proof

I hereby claim:

  • I am idlework on github.
  • I am hipisuit (https://keybase.io/hipisuit) on keybase.
  • I have a public key ASBpiUwZx8FLgPho-SdX0fA3FHjgEwLj79oTDbBjxdzYbAo

To claim this, I am signing this object:

@idlework
idlework / .json
Created December 18, 2018 21:54
getRates.Live.Multi raw output in the app
{
"getHotelRates.Live.Multi": {
"results": {
"status": "Success",
"status_code": 100,
"hotel_data": {
"hotel_0": {
"id": "700077258",
"check_in_time": "14:00",
"check_out_time": "11:00",
@idlework
idlework / PlotLine.js
Created September 9, 2018 22:20
Linear interpolate line
const points = [{ x: 258.5, y: 0 }, { x: 516, y: 515 }, { x: 1, y: 515 }]
// Plot triangle with 99 points
const sideA = this.plotSide(points[0], points[1], 33)
const sideB = this.plotSide(points[1], points[2], 33)
const sideC = this.plotSide(points[2], points[0], 33)
console.log(sideA, sideB, sideC)
plotSide (start, end, count) {
const steps = []
@idlework
idlework / PlotCircle.js
Created September 9, 2018 21:52
Plot circle
const center = { x: 100, y: 100 }
const count = 100
const radius = 100
const points = []
for (let i = 0; i < count; i++) {
const point = { x: 0, y: 0 }
const arc = 2 * Math.PI * i / count
point.x = center.x + radius * Math.cos(arc)
point.y = center.y + radius * Math.sin(arc)