Skip to content

Instantly share code, notes, and snippets.

View christ776's full-sized avatar

Christian De Martino christ776

View GitHub Profile
@jonobr1
jonobr1 / google-sheet-to-json.js
Last active April 26, 2024 15:41
A node.js script to convert a Google Sheet into a JSON object
/**
* Simple Node.js script to turn a specific page on a Google Sheet
* into a JSON object for the main purpose of HTML Templating.
*
* @author jonobr1 / http://jonobr1.com
*
*/
var https = require('https');
var path = require('path');
@coenraadhuman
coenraadhuman / inotify.md
Last active April 23, 2024 09:09
Increasing the amount of inotify watchers

Increasing the amount of inotify watchers

Take note this is my personal edited version and the command related to Arch has been changed to work on my Arch system.

Increase inotify watchers

@KristofferEriksson
KristofferEriksson / useIdle.ts
Created January 25, 2024 10:26
React Hook to detect user inactivity based on specified events like mouse movements, touch events or key presses
import { useEffect, useState } from "react";
const defaultEvents = [
"mousemove",
"mousedown",
"touchstart",
"keydown",
"wheel",
"resize",
];
@vladignatyev
vladignatyev / progress.py
Last active March 31, 2024 22:54
Python command line progress bar in less than 10 lines of code.
# The MIT License (MIT)
# Copyright (c) 2016 Vladimir Ignatev
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the Software
# is furnished to do so, subject to the following conditions:
#
@wesbos
wesbos / async-await.js
Created February 22, 2017 14:02
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@calt
calt / Tabbar.Swift
Last active January 9, 2024 05:58
UITabBar with custom height in Swift, does not work for iOS 14 or later.
// Does not work on iOS 14.0 or later, keeping the gist just for reference.
extension UITabBar {
override open func sizeThatFits(size: CGSize) -> CGSize {
super.sizeThatFits(size)
var sizeThatFits = super.sizeThatFits(size)
sizeThatFits.height = 71
return sizeThatFits
}
}
@learncodeacademy
learncodeacademy / generators.md
Last active January 7, 2024 11:58
What are Javascript Generators?

##what are generators##

  • They're pausable functions, pausable iterable functions, to be more precise
  • They're defined with the *
  • every time you yield a value, the function pauses until .next(modifiedYieldValue) is called
var myGen = function*() {
  var one = yield 1;
  var two = yield 2;
  var three = yield 3;
 console.log(one, two, three);
@GeoffreyCoulaud
GeoffreyCoulaud / README.md
Last active December 21, 2023 01:59
PROOF OF CONCEPT - Installing TeknoParrot on Linux

Installing TeknoParrot on Linux

⚠️ You should not execute scripts that you don't understand and trust from the internet.

1. Using Lutris

Both methods need you to provide a teknoparrot release archive. You can find it here.

Install from Lutris' website

Note : TeknoParrot is at the moment pending on Lutris.net, and so is my installer. You can find my install script on Lutris

// compile with: clang++ main.cpp -o image_exmple -lSDL2 -lSDL2_image
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <cstdio>
#include <string>
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
SDL_Window *window = NULL;
@kristopherjohnson
kristopherjohnson / KeyboardNotification.swift
Last active October 6, 2023 14:45
Swift convenience wrapper for the userInfo values associated with a UIKeyboard notification
import UIKit
/// Wrapper for the NSNotification userInfo values associated with a keyboard notification.
///
/// It provides properties that retrieve userInfo dictionary values with these keys:
///
/// - UIKeyboardFrameBeginUserInfoKey
/// - UIKeyboardFrameEndUserInfoKey
/// - UIKeyboardAnimationDurationUserInfoKey
/// - UIKeyboardAnimationCurveUserInfoKey