Skip to content

Instantly share code, notes, and snippets.

View miguelludert's full-sized avatar

Miguel Ludert miguelludert

View GitHub Profile
@miguelludert
miguelludert / aws-cdk-best-practices.md
Last active February 17, 2023 19:24
AWS CDK Best practices
  1. Put storage (dynamo, rds, s3, etc) in its own nested stack, seperate from other resources, and reference them externally. This allows us to delete all other resources types without affecting existing storage.
  2. When possible, do not pass in whole resources from one stack to another. This is fine for nested stacks within the same parent stack, but in the 'main' context it creates tight coupling between stacks and can make them more brittle to change.
@miguelludert
miguelludert / remapping.sh
Created November 26, 2020 16:25
Keyboard remapping
# guide https://www.nanoant.com/mac/macos-function-key-remapping-with-hidutil
# map https://www.freebsddiary.org/APC/usb_hid_usages.php
hidutil property --matching '{"ProductID":0x07a5}' --set '{
"UserKeyMapping":[
{"HIDKeyboardModifierMappingSrc":0x000700000039,"HIDKeyboardModifierMappingDst": 0x00070000002b},
{"HIDKeyboardModifierMappingSrc":0x0007000000E0,"HIDKeyboardModifierMappingDst": 0x0007000000E3},
{"HIDKeyboardModifierMappingSrc":0x0007000000E4,"HIDKeyboardModifierMappingDst": 0x0007000000E7},
{"HIDKeyboardModifierMappingSrc":0x0007000000E3,"HIDKeyboardModifierMappingDst": 0x0007000000E0},
{ "hello" : "world" }
@miguelludert
miguelludert / soemthing.js
Created October 5, 2017 16:34
Unit testing boilerplate (JS)
const sinon = require('sinon');
const _ = require('lodash');
const chai = require('chai');
const unique = ()=> Math.random().toString();
const quickCommand = (command, obj, ...keys) => {
_.forEach(keys, function(item){
obj[item] = sinon[command](obj, item);
});
};
@miguelludert
miguelludert / index.md
Last active August 9, 2017 18:45 — forked from jethrolarson/index.md
My interview question topics

CSS

  • How does the cascade work
  • Box Model
  • Preprocessors
  • Class naming schemes
  • CSS Frameworks
  • Position absolute vs relative
  • How do you center things vertically
  • What can you do to manage the css of large projects?
@miguelludert
miguelludert / valuesToList.js
Created February 13, 2017 02:59
Linked List Madness
function valuesToList() {
var head, tail;
head = tail = { value : arguments[0] };
for(var i = 1; i < arguments.length; i++){
tail = tail.next = { value : arguments[i] };
}
return head;
}
@miguelludert
miguelludert / MapMvcAttributeRoutes.cs
Created December 29, 2016 21:20
Unit Testing Routes
public static void MapMvcAttributeRoutes(this RouteCollection routeCollection, Assembly controllerAssembly)
{
var controllerTypes = (from type in controllerAssembly.GetExportedTypes()
where
type != null && type.IsPublic
&& type.Name.EndsWith("Controller", StringComparison.OrdinalIgnoreCase)
&& !type.IsAbstract && typeof(IController).IsAssignableFrom(type)
select type).ToList();
var attributeRoutingAssembly = typeof(RouteCollectionAttributeRoutingExtensions).Assembly;
@miguelludert
miguelludert / Injection.cs
Created December 28, 2016 19:37
Minimal Dependency Injection
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace ThinkingSites
{
public class Injection
{
private static Dictionary<Type, Func<object>> Registry = new Dictionary<Type, Func<object>>();
@miguelludert
miguelludert / virtualenv.sh
Last active September 3, 2016 00:14
Set up virtualenv
virtualenv --no-site-packages ./
. bin/activate
pip install nodeenv
nodeenv --node=X.X.X -p
npm install -g npm
git clone [email protected]:your-user/ua-b2c.git
@miguelludert
miguelludert / Modal.jsx
Created April 4, 2016 18:52
Quick modal for React
var React = require('react');
var ReactDOM = require('react-dom');
var document = global.document;
module.exports = React.createClass({
componentDidMount : function() {
this.node = document.getElementById('component-modal-overlay');
if(!this.node){
this.node = document.createElement("div");
this.node.id = 'component-modal-overlay'