Skip to content

Instantly share code, notes, and snippets.

View rafasashi's full-sized avatar
👍
Happy

Raphaël Dartigues rafasashi

👍
Happy
View GitHub Profile
@revolunet
revolunet / lzw_encoder.js
Created February 25, 2011 14:55
LZW javascript compress/decompress
// LZW-compress a string
function lzw_encode(s) {
var dict = {};
var data = (s + "").split("");
var out = [];
var currChar;
var phrase = data[0];
var code = 256;
for (var i=1; i<data.length; i++) {
currChar=data[i];
@adamloving
adamloving / temporary-email-address-domains
Last active November 6, 2024 21:44
A list of domains for disposable and temporary email addresses. Useful for filtering your email list to increase open rates (sending email to these domains likely will not be opened).
0-mail.com
0815.ru
0clickemail.com
0wnd.net
0wnd.org
10minutemail.com
20minutemail.com
2prong.com
30minutemail.com
3d-painting.com
@eusonlito
eusonlito / foldersize.php
Last active September 24, 2024 18:47
PHP function to get the folder size including subfolders
<?php
function folderSize ($dir)
{
$size = 0;
foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $each) {
$size += is_file($each) ? filesize($each) : folderSize($each);
}
@robinvdvleuten
robinvdvleuten / lambda-helloWorld.php
Last active September 6, 2024 13:19
Invoke sample Lambda function through PHP
<?php
require_once __DIR__.'/vendor/autoload.php';
use Aws\Lambda\LambdaClient;
$client = LambdaClient::factory([
'version' => 'latest',
// The region where you have created your Lambda
'region' => 'eu-west-1',
@marcosnakamine
marcosnakamine / example_feed_xml_rss.xml
Created March 22, 2017 20:20
Google Merchant - Feed example in xml
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
<channel>
<title>Example - Online Store</title>
<link>http://www.example.com</link>
<description>
This is a sample feed containing the required and recommended attributes for a variety of different products
</description>
<!--
First example shows what attributes are required and recommended for items that are not in the apparel category
@sakalauskas
sakalauskas / FontAwesome-v5.0.9-Free.json
Last active August 18, 2024 04:26
List of all Font Awesome 5 icons in JSON Cheetsheet
{
"fas fa-address-book","fas fa-address-card","fas fa-adjust","fas fa-align-center","fas fa-align-justify","fas fa-align-left","fas fa-align-right","fas fa-allergies","fas fa-ambulance","fas fa-american-sign-language-interpreting","fas fa-anchor","fas fa-angle-double-down","fas fa-angle-double-left","fas fa-angle-double-right","fas fa-angle-double-up","fas fa-angle-down","fas fa-angle-left","fas fa-angle-right","fas fa-angle-up","fas fa-archive","fas fa-arrow-alt-circle-down","fas fa-arrow-alt-circle-left","fas fa-arrow-alt-circle-right","fas fa-arrow-alt-circle-up","fas fa-arrow-circle-down","fas fa-arrow-circle-left","fas fa-arrow-circle-right","fas fa-arrow-circle-up","fas fa-arrow-down","fas fa-arrow-left","fas fa-arrow-right","fas fa-arrow-up","fas fa-arrows-alt","fas fa-arrows-alt-h","fas fa-arrows-alt-v","fas fa-assistive-listening-systems","fas fa-asterisk","fas fa-at","fas fa-audio-description","fas fa-backward","fas fa-balance-scale","fas fa-ban","fas fa-band-aid","fas fa-barcode","fas fa-bars",
@rafasashi
rafasashi / php languages array
Created July 7, 2018 08:52
PHP var_export of 180+ languages with data including name, native, iso codes, language family, language script, language cultures, and other attributes
array (
'aa' =>
array (
'name' => 'Afar',
'native' => 'Afaraf',
'iso_639_1' => 'aa',
'iso_639_2' => 'aar',
'iso_639_3' => 'aar',
'script' =>
@rafasashi
rafasashi / thousandsCurrencyFormat.php
Created September 1, 2018 15:25
Here comes a PHP function to format numbers to nearest thousands such as Kilos, Millions, Billions, and Trillions with comma https://code.recuweb.com/2018/php-format-numbers-to-nearest-thousands/
function thousandsCurrencyFormat($num) {
if( $num > 1000 ) {
$x = round($num);
$x_number_format = number_format($x);
$x_array = explode(',', $x_number_format);
$x_parts = array('k', 'm', 'b', 't');
$x_count_parts = count($x_array) - 1;
$x_display = $x;
/* *******************************************************************************************
* PUPPETEER
* https://pptr.dev/
* ******************************************************************************************* */
// When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win)
// that is guaranteed to work with the API.
npm install puppeteer