Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
:trollface:

Ivan Sanz Carasa isc30

💭
:trollface:
View GitHub Profile
@tvler
tvler / hoc.tsx
Last active Nov 7, 2021
A type-safe high-order-component creator that injects a prop named a given string, with a type inferred by a given hook's return value.
View hoc.tsx
/**
* A type-safe high-order-component creator
* that injects a prop named a given string,
* with a type inferred by a given hook's
* return value.
*
* Ex:
* const Component = ({ name }) => {
* return <>Hello {name}</>;
* };
@Ghostnipple
Ghostnipple / Bustabit Results History
Last active Jan 12, 2022
This script will generate past game results for Bustabit. Copy the script below and paste it in to a new script window on bustabit. Please note this version only generates the past results, not future results. The save to file option has never worked for me. Script produced by Dsetzer (original can be found at https://gist.github.com/dsetzer.)
View Bustabit Results History
//Script was produced by Dsetzer original can be found at https://gist.github.com/dsetzer
//In the script panel in Bustabit create a new script. Copy the script below and paste it in to the script window on bustabit.
//Please note this version will only give you past results and not future results.
//The script has a save to file option, but this has never worked for me.
var config = {
span: { label: 'Previous Games', type: 'number', value: '100' },
outh: { label: 'Include Hashes', type: 'checkbox', value: false },
ocsv: { label: 'Download CSV', type: 'checkbox', value: true}
};
@lostpebble
lostpebble / pullstate-local-storage.ts
Created Aug 20, 2019
One way to create a local storage solution with Pullstate
View pullstate-local-storage.ts
import { Store } from "pullstate";
import { LocalStorage } from "@gt/gt-frontend/build/localStorage/LocalStorage";
import { get, pick, set } from "lodash";
interface IStoreWithValues<S> {
key: string;
store: Store<S>;
values?: Array<keyof S>;
deepValues?: string[];
}
View safari-reaper.html
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body {
background: repeat url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/7QCIUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAGscAVoAAxslRxwCAAACAAAcAnQAV8KpIENoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbGQgLSBodHRwOi8vd3d3LnJlZGJ1YmJsZS5jb20vcGVvcGxlL0NoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAAABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAADTAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJDAAAEPAAACAxnVFJDAAAEPAAACAxiVFJDAAAEPAAACAx0ZXh0AAAAAENvcHlyaWdodCAoYykgMTk5OCBIZXdsZXR0LVBhY2thcmQgQ29tcGFueQAAZGVzYwAAAAAAAAASc1JHQiBJRUM2MTk2Ni0yLjEAAAAAAAAAAAAAABJzUkdCIElFQzYxOTY2LTIuMQAAAAAAAA
View conceptsV2.cpp
#include <iostream>
#include <vector>
#include <type_traits>
#include <tuple>
namespace sfinae
{
using success = std::true_type;
using fail = std::false_type;
@isc30
isc30 / installArsys.bash
Last active Jul 25, 2016
Install DnsUpdater for Arsys
View installArsys.bash
#!/bin/bash
if [ "$(whoami)" != "root" ]; then
echo "Run script as ROOT please. (sudo !!)"
exit
fi
apt-get update -y
apt-get install -t stretch -y php7.0-soap
apt-get autoremove -y
@0x263b
0x263b / colors.md
Last active Dec 22, 2021
Random color from string in javascript
View colors.md

Random color from string in javascript

Consider a list of strings you need to permanently assign a random color.

First you should turn the string into a hash.

var string = "string"
var hash = 0
@isc30
isc30 / install.bash
Last active Jan 27, 2021
Raspberry Pi Install PHP7 + Nginx + MySQL + PhpMyAdmin (last versions)
View install.bash
#!/bin/bash
# Thanks to https://gist.github.com/Lewiscowles1986/ce14296e3f5222082dbaa088ca1954f7
if [ "$(whoami)" != "root" ]; then
echo "Run script as ROOT please. (sudo !!)"
exit
fi
echo "deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi" > /etc/apt/sources.list.d/stretch.list
echo "APT::Default-Release \"jessie\";" > /etc/apt/apt.conf.d/99-default-release
@Lewiscowles1986
Lewiscowles1986 / rPi3-php7-setup.sh
Last active Nov 8, 2019
Raspberry Pi PHP7, Nginx 1.9 Installer
View rPi3-php7-setup.sh
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Must be root"
exit
fi
apt-get update -y
apt-get upgrade -y
apt-get dist-upgrade -y
@vittorioromeo
vittorioromeo / hello_triangle.cpp
Created Oct 10, 2015
SDL2 + OpenGL ES 2.0 - "Hello triangle" example that works both on X11 and Emscripten
View hello_triangle.cpp
#include <exception>
#include <functional>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>