This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import {View} from "react-native"; | |
import {Text, IconButton} from "react-native-paper"; | |
const Alert = ({severity, message}) => { | |
let msg = message === undefined || message === null ? 'undefined' : message; | |
let svt; | |
let icon; | |
let border; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Data Generation | |
start.time <- Sys.time() | |
random.data <- c("Hola", sample(1:100, 1000, replace=TRUE), "adios") | |
myInput <- data.frame('number' = random.data) | |
myInput$isNumber <- myInput$number == as.integer(myInput$number) | |
myInput$isNumber <- ifelse(!is.na(myInput$isNumber), TRUE, FALSE) | |
splitted <- split(myInput, myInput$isNumber == TRUE) | |
myNumbers <- splitted[['TRUE']] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from "react"; | |
export default function StackExample() { | |
const [myArray, setMyArray] = useState([]); | |
const addElement = () => { | |
var myArrayCopy = [...myArray]; | |
var newKey = myArray.length; | |
myArrayCopy.push({ | |
item: <input disabled type="button" key={newKey} value={newKey} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# REPLACE ELEMENTS SURROUNDED BY ANGLE BRACKETS ACCORDING TO YOUR NEEDS | |
git filter-branch --commit-filter ' | |
if [ "$GIT_COMMITTER_NAME" = "<NAME OF USER TO BE REPLACED>" ]; | |
then | |
GIT_COMMITTER_NAME="<NEW USER NAME OF THE COMMIT"; | |
GIT_AUTHOR_NAME="<NEW USER NAME OF THE COMMIT>"; | |
GIT_COMMITTER_EMAIL="<NEW USER EMAIL OF THE COMMIT>"; | |
GIT_AUTHOR_EMAIL="<NEW USER EMAIL OF THE COMMIT>"; | |
git commit-tree "$@"; | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Switch example for python 3 """ | |
def _say_hello() -> str: | |
return 'Hello' | |
def _say_goodbye() -> str: | |
return 'Good bye' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Dumb way to produce immutable instances in Python """ | |
class ImmutablePerson(object): | |
""" ... """ | |
__slots__ = ('name', 'dob') | |
def __init__(self, name: str, dob: str): | |
""" Only available at initialization """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Just playing around with slots (BASIC EXAMPLE Plain Old Python Object) """ | |
import re | |
date_pattern = re.compile(r'(\d{4})[/.-](\d{2})[/.-](\d{2})$') | |
class Person(object): | |
""" Person sample class with slots """ | |
__slots__ = ('name', 'dob') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* To get rid of the useless subscription block of the digital diary "20Minutes" | |
* Works as of July 2020 | |
* Just copy and paste the follwoing code to the browser's console at 20minutes site | |
*/ | |
function enableRead() { | |
// Allow scroll down | |
var body = document.getElementsByTagName("body") | |
body[0].setAttribute("style", "") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Generates random time intervals """ | |
import random | |
for x in range(30): | |
entry_h = random.randint(8, 10) | |
entry_m = random.randint(0, 59) | |
if entry_h == 10: | |
entry_m = 0 |
NewerOlder