Skip to content

Instantly share code, notes, and snippets.

@marsbomber
marsbomber / manager-readme.md
Last active June 8, 2021 07:05
Manager README

Hi, this is Jim

Thanks for dropping by. After reading this readme, I hope you can learn how I think and how I work.

What makes me turn up to work

First and foremost, I'm excited to work with you together to achieve our team goals

The best way I know to achieve excellence is for us to work as a team.

@marsbomber
marsbomber / remap-capslock-to-control-win10.md
Created March 5, 2020 03:46 — forked from joshschmelzle/remap-capslock-to-control-win10.md
Remap Caps Lock to Control on Windows 10

Create a new binary value in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout named Scancode Map

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00

or use PowerShell (run as Admin)

@marsbomber
marsbomber / createBatchActions.js
Created September 29, 2018 23:07 — forked from GuillaumeJasmin/createBatchActions.js
Batch actions async for redux-batched-actions
import { isPlainObject } from 'lodash';
import { batchActions as batchActionsDefault } from 'redux-batched-actions';
const handleInnerAction = (action, getState) => {
if (typeof action === 'function') {
return new Promise(resolve => {
const innerDispatch = innerAction => resolve(handleInnerAction(innerAction, getState));
action(innerDispatch, getState);
});
} else if (isPlainObject(action)) {
// utils/partial.js
export const partial = (func, ...args) => func.bind(null, ...args);
// actions/maths.js
export const addNumberOneAndNumberTwo = (first, second) => {
return {
type: 'SOMETHING THE REDUCER CAN CATCH',
first,
second,
};
@marsbomber
marsbomber / cloudSettings
Last active July 13, 2020 05:24
Visual Studio Code Sync Settings Gist
{"lastUpload":"2020-07-13T04:56:31.742Z","extensionVersion":"v3.4.3"}
@marsbomber
marsbomber / gist:4325345
Last active December 9, 2015 20:39
Rework on uni year one assignment question. Given any amount in cents, calculate changes
module ChangeMachine
class IdiotEncountered < StandardError; end
AVAILABLE_UNITS = [10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5]
def self.show_me_the_money(dollar_in_cents)
raise IdiotEncountered, "You are an idiot, no such amount in AUS..." unless dollar_in_cents % 5 == 0
dispense(dollar_in_cents)
@marsbomber
marsbomber / gist:4325320
Created December 18, 2012 05:30
Given an array of INTs, calculate each INT's percentage contribution towards the sum of all INTs. Rounding needs to be done so that output floats can sum to a perfect 100%
def percentagerize(collection, result=[], remainder=1)
collection = Array(collection)
return result if collection.count == 0
denominator = collection.inject(:+)
percent = 0.0
unless denominator == 0
percent = (remainder * (collection[0] / denominator.to_f)).round(4)
@marsbomber
marsbomber / gist:4291868
Created December 15, 2012 07:06
Make up 100% CSS width from doing percentage calculation
I'll illustrate the problem with an example.
I query the database for some aggregated results. Say there are 4
aggregated counters I'm interested in and wanting to display them
in a 100% width div. Each of the counters should contribute to a
percentage of the full width.
For instance, my db query returns me somthing like this
| counter_1 | counter_2 | counter_3 | counter 4|
require 'spec_helper'
describe "RequestsDashboard", js: true do
let!(:req_processing_one) { create(:request, state: "processing", url: "processing-job-url-1") }
context "Processing requests" do
it "displays request details modal" do
find(:xpath, "//a[@href='#{job_request_admin_request_path(req_processing_one)}']").click
# this is passing on
@marsbomber
marsbomber / yaml_parse.rb
Created January 29, 2012 06:25
Ruby 1.9.3 YAML parse
require 'yaml'
yaml = <<yaml
defaults: &defaults
cool:
bang: wow
fruit: apple
development:
<<: *defaults