Skip to content

Instantly share code, notes, and snippets.

View Falci's full-sized avatar
🍉

Fernando Falci Falci

🍉
View GitHub Profile
#!/bin/bash
FILE=~/.ip
IP=$(curl -s ifconfig.co)
OLD=$(cat "$FILE");
if [[ "$OLD" == "$IP" ]]; then
echo "No IP change";
else
echo "IP changed";

Keybase proof

I hereby claim:

  • I am falci on github.
  • I am falci (https://keybase.io/falci) on keybase.
  • I have a public key whose fingerprint is 6B39 1E26 80DF C0B9 9C8C 892B 8206 EE41 E720 442D

To claim this, I am signing this object:

import { useReducer } from "react";
const stored = localStorage.getItem("data");
const emptyStore = { ... };
const initialState = (stored && JSON.parse(stored)) || emptyStore;
const reducer = (state, action) => {
switch (action.type) {
case "increment":
return { count: state.count + 1 };
import { useState, useEffect } from 'react';
const STORAGE_KEY = 'auth_token';
const getToken = () => window.localStorage.getItem(STORAGE_KEY);
const clearToken = () => window.localStorage.removeItem(STORAGE_KEY);
const setToken = token =>
token ? window.localStorage.setItem(STORAGE_KEY, token) : clearToken();
const useApi = (url, options = {}) => {
const g7r = (word='') => word.length < 3 ? word : word[0] + (word.length -2) + word[word.length-1];
g7r('generator'); // g7r
g7r('internationalization'); // i18n
g7r('accessibility'); // a11y
{
"name": "demo",
"version": "1.0.0",
"funding": {
"type": "buymeacoffee",
"url": "https://www.buymeacoffee.com/falci"
},
"author": "Falci",
"license": "MIT"
}
const highlight = ([...strings], ...values) => strings.reduce(
(sentence, string) => `${sentence}<strong>${values.shift()}</strong>${string}`,
strings.shift()
);
const name = 'F_NAME';
const what = 'project';
const sentence = highlight`Good luck ${name} in your new ${what}`;
console.log(sentence); // Good luck <strong>F_NAME</strong> in your new <strong>project</strong>

Keybase proof

I hereby claim:

  • I am falci on github.
  • I am falci (https://keybase.io/falci) on keybase.
  • I have a public key ASBaC9L0H5qiid356sA45sVZTrLL1i0YdNFQjuKVhoOZYAo

To claim this, I am signing this object:

function hasAlphaChars(original, cleaned) {
return !(original.match(/[a-z]/gi)) ? cleaned : null;
}
function hasIncorrectLength(original, cleaned) {
return (cleaned && cleaned.length == 10) ? cleaned : null;
}
function clear(original) {
let cleaned = original.replace(/[^0-9]/g, '');
.Header {
background: linear-gradient(to right, #132a6c 0%,#a6cdf5 100%);
height: 40px;
padding-bottom: 5px;
padding-top: 5px;
}
.HeaderNavlink {
text-decoration: underline;
}