Skip to content

Instantly share code, notes, and snippets.

View lukaswilkeer's full-sized avatar

Lukas Wilkeer lukaswilkeer

View GitHub Profile

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@domenic
domenic / promises.md
Last active June 13, 2025 14:15
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@romansklenar
romansklenar / REAME.md
Last active June 9, 2025 07:28
How to set up your VPS with Chef Solo

How to set up your VPS with Chef Solo

1. What is it?

There are many different provisioning tools out there, the most popular of which are Chef and Puppet. Chef uses Ruby, Puppet uses a DSL (Domain Specific Language), there are others that use simple bash too, but today we're going to focus on Chef Solo.

2. Dependencies

To get Chef working properly on your local machine you need a few things.

Make sure you use Ruby 1.9.x and not Ruby 2.x as you will get errors with the json 1.6.1 gem on 2.x. Use rbenv or RVM to manage several different Rubies on the one machine.

@dfkaye
dfkaye / mocking-private-functions.md
Last active March 13, 2019 15:40
mocking - not testing - private functions in JavaScript, using new Function() - followup to https://gist.github.com/dfkaye/5971486

Mocking - not testing - private functions in JavaScript

Instead of trying to extract a private function, we can rely on mocking/spying. This gist shows how to use the "new Function()" constructor to replace an internal call so that we can mock, spy or stub.

Another response to @philwalton - 
http://philipwalton.com/articles/how-to-unit-test-private-functions-in-javascript/

This is a followup to https://gist.github.com/dfkaye/5971486 - a suggestion for 
*annotating* functions to be extracted and tested separately (publicly).
@staltz
staltz / introrx.md
Last active July 13, 2025 10:33
The introduction to Reactive Programming you've been missing
@joyrexus
joyrexus / README.md
Last active June 8, 2023 07:45
form-data vs -urlencoded

Nice answer on stackoverflow to the question of when to use one or the other content-types for POSTing data, viz. application/x-www-form-urlencoded and multipart/form-data.

“The moral of the story is, if you have binary (non-alphanumeric) data (or a significantly sized payload) to transmit, use multipart/form-data. Otherwise, use application/x-www-form-urlencoded.”


Matt Bridges' answer in full:

The MIME types you mention are the two Content-Type headers for HTTP POST requests that user-agents (browsers) must support. The purpose of both of those types of requests is to send a list of name/value pairs to the server. Depending on the type and amount of data being transmitted, one of the methods will be more efficient than the other. To understand why, you have to look at what each is doing

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
'use strict'
/**/
function moda (arr) {
return ((arr.sort((a, b) =>
(arr.filter(v => v === a).length) - (arr.filter(v => v === b).length))
).pop())
}
module.exports = moda
console.log(moda([1,2,3,4,5])) //amodal nao tem moda(nao deveria aparecer nada)
@lukaswilkeer
lukaswilkeer / rules.js
Last active September 8, 2019 11:39
tiny-validator
const rules = {
'env': {
rule: (value) => rules.env.property.includes(value)
, property: ['production', 'sandbox']
, default: 'sandbox'
, errorMsg: 'Env must be production or sandbox'
},
'email': {
rule: (value) => value ? true : false
@Madh93
Madh93 / Ruby_Proxy_Pattern_And_Metaprogramming.md
Last active December 11, 2020 01:03
Ruby, Proxy Pattern and Metaprogramming

Ruby, Proxy Pattern and Metaprogramming

You have this class:

class BankAccount
  attr_reader :balance

  def initialize(starting_balance = 0)
 @balance = starting_balance