Skip to content

Instantly share code, notes, and snippets.

View israelss's full-sized avatar
📚
Learning 📚

Israel Sant'Anna israelss

📚
Learning 📚
View GitHub Profile
@mildmojo
mildmojo / rotate_desktop.sh
Created June 18, 2014 06:47
Script to rotate the screen and touch devices on modern Linux desktops. Great for convertible laptops.
#!/bin/bash
#
# rotate_desktop.sh
#
# Rotates modern Linux desktop screen and input devices to match. Handy for
# convertible notebooks. Call this script from panel launchers, keyboard
# shortcuts, or touch gesture bindings (xSwipe, touchegg, etc.).
#
# Using transformation matrix bits taken from:
# https://wiki.ubuntu.com/X/InputCoordinateTransformation
@gampleman
gampleman / README.md
Created September 10, 2014 03:08
Algorithm to find a short unique CSS selector from an arbitrary node

This algorithm when passed a DOM node will find a very short selector for that element.

@dimasch
dimasch / redis-clear
Last active July 5, 2024 07:16
Clear a redis cache in Docker
docker exec -it container-name redis-cli FLUSHALL
@israelss
israelss / keyindicator
Created February 7, 2017 03:34
Script to display [Caps/Num/Scroll]Lock on Polybar
#! /usr/bin/env bash
#
# Copyright 2016 Israel Sant'Anna <israelsantanna at gmail dot com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@zcaceres
zcaceres / Error-Handling-Patterns-Express.md
Last active August 3, 2023 13:40
error handling patterns in Express

Handling Errors

Express.js makes it a breeze to handle errors in your routes.

Express lets you centralizes your error-handling through middleware.

Let's look at patterns for how to get the most out of your error-handling.

First, our error-handling middleware looks like this:

@Woodsphreaker
Woodsphreaker / range.js
Last active December 22, 2017 17:39
range.js
const range = (start = 0, end = 1) => Array.from({"length": (end + 1) - start}, (_, i) => start + i)
console.log(range(-10, 10)); // [ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
@israelss
israelss / range.js
Created May 29, 2017 16:45 — forked from Woodsphreaker/range.js
range.js
const range = (start = 0, end = 1) => Array.from({"length": (end + 1) - start})
.map((_, i) => start + i);
console.log(range(-10, 10)); // [ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
@slightfoot
slightfoot / main.dart
Last active January 2, 2024 05:53
Flutter Drop List Example with TextField
import 'package:flutter/material.dart';
void main()
{
final TextEditingController _controller = new TextEditingController();
var items = ['Working a lot harder', 'Being a lot smarter', 'Being a self-starter', 'Placed in charge of trading charter'];
runApp(
new MaterialApp(
title: 'Drop List Example',
home: new Scaffold(
@israelss
israelss / One-liner npm package inspector
Created March 27, 2022 20:30
Find out what will be published to npm in a package without actually publishing it
if you want to find out what files npm will publish into the tarball without actually publishing, you can use this little one-liner:
npm pack && tar -xvzf *.tgz && rm -rf package *.tgz
Found @ https://medium.com/@jdxcode/for-the-love-of-god-dont-use-npmignore-f93c08909d8d in 2022-03-27
@Luisgustavom1
Luisgustavom1 / ComposeProviders.tsx
Last active December 27, 2022 19:10
Compose React Providers to avoid too much chaining
import React from 'react'
interface IComposeProvidersProps {
with: Array<React.ElementType>
children: React.ReactNode
}
export const ComposeProviders = ({
with: Providers,
children,