Skip to content

Instantly share code, notes, and snippets.

View .md

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 Jun 19, 2020
React hook check if element is in viewport
View useInViewport.tsx
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 Feb 12, 2019
Support page for Aktie Block
View support.md

Add a comment below to get support

View gist:2f5920c894f241c09935289e821b2bad
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 Sep 9, 2017
Code in the dark - NordicJS - 2017
View result.html
<!doctype html>
<style>
* {
margin: 0;
padding: 0;
font-size: 16px;
}
.hejsan {
position:relative;
}
View react-native.md

Requirements

  • node
  • npm
  • yarn

First time computer setup

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

Create project

View gist:bcbe9ebaff8c6692cb80e14f86d949fc
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 Jun 25, 2020
Smooth scrollToElement
View scrollToElement.ts
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 Nov 20, 2015
Aktie SMS notifikation 2010-04-10
View aktie_fetch.php
<?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 Jan 9, 2018
Ractive.extend options as TypeScript Class - http://jsfiddle.net/qnjgsq1L/
View gist:c91bc144a822c3fb0fc2
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 {