Skip to content

Instantly share code, notes, and snippets.

@codler
codler / .md
Last active October 12, 2020 10:20

New OS

sudo apt update
sudo apt full-upgrade

Check most used disk usage by folder

sudo du -a / 2>/dev/null | sort -n -r | head -n 20

Save space

sudo apt clean
uname -r
@codler
codler / useInViewport.tsx
Last active May 25, 2023 07:32
React hook check if element is in viewport
import { useState, useEffect, RefObject, useCallback } from "react";
function isElementInViewport(el: Element) {
var rect = el.getBoundingClientRect();
return (
rect.bottom >= 0 &&
rect.right >= 0 &&
rect.top <= (window.innerHeight || document.documentElement.clientHeight) &&
rect.left <= (window.innerWidth || document.documentElement.clientWidth)
@codler
codler / support.md
Created February 12, 2019 21:30
Support page for Aktie Block

Add a comment below to get support

@codler
codler / gist:2f5920c894f241c09935289e821b2bad
Created February 12, 2019 21:21
Privacy Policy of Aktie Block
Privacy Policy
Han Lin Yap built the Aktie Block app as an Ad Supported app. This SERVICE is provided by Han Lin Yap at no cost and is intended for use as is.
This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.
If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.
The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at Aktie Block unless otherwise defined in this Privacy Policy.
Information Collection and Use
@codler
codler / result.html
Created September 9, 2017 08:27
Code in the dark - NordicJS - 2017
<!doctype html>
<style>
* {
margin: 0;
padding: 0;
font-size: 16px;
}
.hejsan {
position:relative;
}

Requirements

  • node
  • npm
  • yarn

First time computer setup

brew install watchman
sudo npm install -g react-native-cli

Create project

@codler
codler / gist:bcbe9ebaff8c6692cb80e14f86d949fc
Created July 16, 2017 23:00
Privacy Policy of Hunddata
Privacy Policy of Hunddata
In order to receive information about your Personal Data, the purposes and the parties the Data is shared with, contact the Owner.
Data Controller and Owner
Types of Data collected
The owner does not provide a list of Personal Data types collected.
Other Personal Data collected may be described in other sections of this privacy policy or by dedicated explanation text contextually with the Data collection.
The Personal Data may be freely provided by the User, or collected automatically when using this Application.
Any use of Cookies - or of other tracking tools - by this Application or by the owners of third party services used by this Application, unless stated otherwise, serves to identify Users and remember their preferences, for the sole purpose of providing the service required by the User.
Failure to provide certain Personal Data may make it impossible for this Application to provide its services.
Users are responsible for any Personal Data of third parties obtained, published
@codler
codler / scrollToElement.ts
Last active June 25, 2020 09:32
Smooth scrollToElement
function scrollTo(targetPosition: number, scrollDistance: number, duration: number, easing: Function) {
let time = 0;
const minTime = 0;
const diff = Math.max(Math.min(scrollDistance, 100), -100);
if (diff === 0) {
return;
}
for (let i = 0, len = Math.abs(diff); i <= len; i++) {
@codler
codler / aktie_fetch.php
Last active November 20, 2015 17:22
Aktie SMS notifikation 2010-04-10
<?php
require_once("connection.php");
$data = urldecode($_POST['data']);
$data = explode("|", $data);
$arr = array();
$alert = array();
foreach ($data AS $v) {
$a = explode("=", $v);
if (is_numeric($a[1])) {
@codler
codler / gist:c91bc144a822c3fb0fc2
Last active January 9, 2018 17:35
Ractive.extend options as TypeScript Class - http://jsfiddle.net/qnjgsq1L/
function RactiveExtendTypeScriptClass(tsClass: any): RactiveStatic {
var instance = new tsClass();
var r = {};
for (var key in instance) {
r[key] = instance[key];
}
return Ractive.extend(r);
}
interface RactiveComponentPlugins {