Skip to content

Instantly share code, notes, and snippets.

View jmurowaniecki's full-sized avatar
🤐
************!

John Murowaniecki jmurowaniecki

🤐
************!
View GitHub Profile
@loilo
loilo / magic-methods.js
Last active April 25, 2024 13:58
PHP Magic Methods in JavaScript
function magicMethods (clazz) {
// A toggle switch for the __isset method
// Needed to control "prop in instance" inside of getters
let issetEnabled = true
const classHandler = Object.create(null)
// Trap for class instantiation
classHandler.construct = (target, args, receiver) => {
// Wrapped class instance
@wandernauta
wandernauta / sp
Last active April 16, 2024 15:37
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/usr/bin/env bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@callmeloureiro
callmeloureiro / comoSerChatoNoWhatsapp.js
Last active January 15, 2024 20:44
Como fazer alguém te responder no whatsapp
/*
Hoje iremos MUDAR a vida da pessoa que não te responde no whatsappp...
Que tal enviar mensagens pra ela até obter uma resposta?!
Sensacional não acha?! Mas, somos devs, correto?! Então vamos automatizar esse paranauê!
Para utilizar:
- Abra o web.whatsapp.com;
- Selecione a conversa que você quer;
- Abra o console e cole o código que está no gist;
@sandroweb
sandroweb / useLocalStorage
Last active January 11, 2024 22:57
A React Hook to manage LocalStorage items with generic type, with set, refresh and remove actions.
import { useCallback, useMemo, useState } from 'react';
export interface useLocalStorageProps<T> {
id: string;
defaultValue: T;
}
export interface useLocalStorageReturn<T> {
setValue: (value: T) => void;
value: T;
@david-mark
david-mark / usestrict.md
Last active December 27, 2023 17:07
'use strict' Considered Pointless and Harmful

'use strict' Considered Pointless and Harmful

What is strict mode?

According to the MDN reference, it is:

ECMAScript 5's strict mode is a way to opt in to a restricted variant of JavaScript [sic].

It goes on to say:

This is a proposal for a lightning talk at the Reactive 2016 conference. If you like this, star the Gist.


Thinking metrics on React applications

In regular websites, it is common to send multiple events to track user clicks. Single Page Applications change the way you look at metrics. This is a talk about a simple pattern we created at Globo.com to manage a metrics layer for http://globoplay.globo.com. The talk will cover how to track user flow using Google Analytics and other services. We solved the challenge of tying metrics and components, keeping information across pages and having global data. Also some React, React Router and React Side Effects concepts like context, higher order components, history state will be covered.

@lauraturk
lauraturk / circleci-heroku-continuous-deployment2.0.md
Last active November 23, 2021 15:28
instructions for deploying from circleci2.0 to heroku
@PurpleBooth
PurpleBooth / am-i-ready-to-open-source-this.md
Last active February 4, 2021 22:17
Checklist to see if your open source repo is primetime ready!

Am I ready to Open Source This?

The checklist:

  1. A readme following a good template
  2. A contributing.md with a code of conduct.
  3. A license
  4. Travis configuration
  5. A way for people to raise issues
  6. Link to it
@wilcorrea
wilcorrea / docker-compose.yml
Last active November 24, 2020 19:58
Docker Compose para manter
version: '3.7'
# make sure everything is running with:
# docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}\t{{.Status}}" | grep "nginx-"
#networks
networks:
#network reverse-proxy
reverse-proxy:
external: true