Skip to content

Instantly share code, notes, and snippets.

View arboleya's full-sized avatar

Anderson Arboleya arboleya

View GitHub Profile
@aleclarson
aleclarson / rollup-typescript.md
Last active April 7, 2024 14:13
The best Rollup config for TypeScript libraries

Features

🔥 Blazing fast builds
😇 CommonJS bundle
🌲 .mjs bundle
.d.ts bundle + type-checking
🧐 Source maps

Install

@github0013
github0013 / FileUploadComponent.jsx
Created May 5, 2017 10:25
how to upload files using graphql + apollo client
class FileUploadComponent extends Component{
upload(){
this.props.mutate({
variables: {
id,
avatar: this.inputFile.files[0] //this is how you send file
}
}).
then(({data}) => {
console.log(data)
@staltz
staltz / comment.md
Created March 15, 2017 15:27
Nested Pick<T, K> in TypeScript 2.2

TypeScript supports Pick to allow you to get a "subset" object type of a given type, but there is no built-in Pick for deeper nested fields.

If you have a function that takes a large object as argument, but you don't use all of its fields, you can use Pick, Pick2, Pick3, etc to narrow down the input type to be only just what you need. This will make it easier to test your function, because when mocking the input object, you don't need to pass all fields of the "large" object.

Raise Open File Limits in OS X

in OS X 10.4 to macOS sierra 10.12 and maybe higher!

Create Launcher Script:

/Library/LaunchDaemons/limit.maxfiles.plist

Copy this entire code block and paste it into your terminal and push Return to create this file for you with correct permissions. It will (probably) ask for your password:

@nicolasembleton
nicolasembleton / restart_bluetooth.sh
Last active October 21, 2022 20:10
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@themeteorchef
themeteorchef / client-signup.coffee
Last active November 29, 2016 12:21
Create user accounts that automatically login without using Accounts.createUser on the client.
Template.signup.events(
'submit form': (e,t) ->
# Prevent form from submitting.
e.preventDefault()
# Grab the user's details.
user =
email: t.find('[name="emailAddress"]').value
password: t.find('[name="password"]').value
@everzet
everzet / sauce_connect_setup.sh
Last active December 18, 2015 00:39
Non-verbose SauceLabs connect setup for Travis
#!/bin/bash
# Setup and start Sauce Connect for your TravisCI build
# This script requires your .travis.yml to include the following two private env variables:
# SAUCE_USERNAME
# SAUCE_ACCESS_KEY
# Follow the steps at https://saucelabs.com/opensource/travis to set that up.
#
# Curl and run this script as part of your .travis.yml before_script section:
# before_script:
@santiycr
santiycr / sauce_connect_setup.sh
Last active December 14, 2015 19:49
A small bash script to download and start Sauce Connect as part of a Travis Build.
#!/bin/bash
# Setup and start Sauce Connect for your TravisCI build
# This script requires your .travis.yml to include the following two private env variables:
# SAUCE_USERNAME
# SAUCE_ACCESS_KEY
# Follow the steps at https://saucelabs.com/opensource/travis to set that up.
#
# Curl and run this script as part of your .travis.yml before_script section:
# before_script:
@vprtwn
vprtwn / README.md
Last active July 3, 2023 14:07
Force Editor + Pan/Zoom

Drag from an existing node to add a new node or link. Click to select/deselect nodes/links. Hit the DELETE key to remove the selected node or link. Drag to pan. Scroll to zoom.

Built with D3.js.

@giuliandrimba
giuliandrimba / namespace.js
Created December 6, 2012 01:45
JavaScript: namespace helper
function namespace(name)
{
var namespaces = name.split(".");
var name = "";
function getName(parent)
{
if(namespaces.length > 0)
{
name = namespaces.shift();