Skip to content

Instantly share code, notes, and snippets.

View benfavre's full-sized avatar
💻
At the office

Webdesign29 benfavre

💻
At the office
View GitHub Profile
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { environment } from '@env/environment';
import { Network } from '@ionic-native/network/ngx';
import { AlertController, Platform } from '@ionic/angular';
import { Storage } from '@ionic/storage';
import { forkJoin, from, Observable, of } from 'rxjs';
import { finalize, switchMap } from 'rxjs/operators';
import { StoredRequest } from '../../models/request';
import { Network } from '@ionic-native/network/ngx';
import { AlertController, Platform } from '@ionic/angular';
export class InitUserProvider {
disconnectSubscription: any;
connectSubscription: any;
networkStatus = true;
constructor(private network: Network, private platform: Platform) {
@burasuk
burasuk / backup.sh
Created June 25, 2020 10:47
simple differential backup based on tar
#!/bin/sh
DATE=`date +%Y-%m-%d__%H-%M`
BACKUP_NAME=$DATE.tar.gz
DIR_TO_BACKUP='dir/to/backup'
# next differential backup
tar -czg snapshot.snar -f $BACKUP_NAME $DIR_TO_BACKUP
@ahmadhasankhan
ahmadhasankhan / ImageMagick-6.7.7-10.md
Last active December 4, 2022 18:57
Install ImageMagick 6.7.7-10 on Unix using binary

Remove imagemagick

sudo apt-get --purge remove imagemagick
sudo apt autoremove

Install Required package:

sudo apt-get install build-essential 
sudo apt-get install checkinstall
@companje
companje / PanZoom.js
Created November 1, 2018 23:11
Pan / Zoom P5.js
//Zoom/Pan Component
//by Rick Companje, Nov 1, 2018.
//Enjoy!
var img;
var w, h, tow, toh;
var x, y, tox, toy;
var zoom = .01; //zoom step per mouse tick
function preload() {
@SimonGoring
SimonGoring / clean_db.sql
Last active September 21, 2022 23:30
Basic Database model for real estate data in Postgres.
/* If you've messed up and need to remove all the tables. */
DROP TABLE listings.person CASCADE;
DROP TABLE listings.property CASCADE;
DROP TABLE listings.agency CASCADE;
DROP TABLE listings.agent CASCADE;
DROP TABLE listings.listing CASCADE;
DROP TABLE listings.offer CASCADE;
@Machy8
Machy8 / jquery.on.js
Last active April 6, 2024 13:07
jQuery .on() alternative in pure javascript (this handles events on dynamically added elements) 😎
/**
* @param {string} eventType
* @param {string} selector
* @param {function} callback
*/
function on(eventType, selector, callback) {
document.body.addEventListener(eventType, function (event) {
if (event.target.matches(selector)) {
callback.call(event.target);
}
@igorbenic
igorbenic / coupon_filter.php
Last active November 24, 2021 20:48
How to manage Order Item Data in WooCommerce | https://www.ibenic.com/manage-order-item-meta-woocommerce
<?php
// WC_Checkout
/**
* Add coupon lines to the order.
*
* @param WC_Order $order Order instance.
* @param WC_Cart $cart Cart instance.
*/
@djrtwo
djrtwo / reward-reduction.md
Created April 24, 2018 02:18
Analysis of Casper PoW Reward Reduction

Analysis of Casper PoW Reward Reduction

EIP 1011 - Hybrid Casper FFG proposes further reducing PoW block reward from 3 ETH to 0.6 ETH. The EIP briefly mentions that this is "because the security of the chain is greatly shifted from PoW difficulty to PoS finality and because rewards are now issued to both validators and miners." This document is to serve as an addendum to that statement, providing additional data, analysis, and arguments.

We aim to show that in Hybrid Casper FFG with an 80% reduction in block reward:

  • a PoW attack on the finality enabled chain cannot do much in comparison to a pure PoW attack
  • a pure PoW attack just as costly as other prominent PoW chains
  • there are options in the event of an attack
  • all of the above is a strong discouragement for an attack to be conducted in the meantime before full pos
@maddisondesigns
maddisondesigns / functions.php
Last active February 7, 2024 13:42
WooCommerce Custom Fields for Simple & Variable Products
/*
* Add our Custom Fields to simple products
*/
function mytheme_woo_add_custom_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
// Text Field