Skip to content

Instantly share code, notes, and snippets.

View ahmeti's full-sized avatar
🎯
Focusing

Ahmet Imamoglu ahmeti

🎯
Focusing
View GitHub Profile
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active March 28, 2024 09:26
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Don't like Next? Here's how to do the same in Gatsby.

@ScripTech
ScripTech / Activate Office 2019 for macOS VoL.md
Created August 10, 2020 18:21 — forked from zthxxx/Activate Office 2019 for macOS VoL.md
crack activate office on mac with license file

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref

@Bogdaan
Bogdaan / varexport.php
Created September 10, 2018 12:31
PHP var_export() with short array syntax (square brackets) indented 4 spaces
<?php
function varexport($expression, $return=FALSE) {
$export = var_export($expression, TRUE);
$export = preg_replace("/^([ ]*)(.*)/m", '$1$1$2', $export);
$array = preg_split("/\r\n|\n|\r/", $export);
$array = preg_replace(["/\s*array\s\($/", "/\)(,)?$/", "/\s=>\s$/"], [NULL, ']$1', ' => ['], $array);
$export = join(PHP_EOL, array_filter(["["] + $array));
if ((bool)$return) return $export; else echo $export;
}
@GhazanfarMir
GhazanfarMir / Instructions.sh
Last active December 21, 2023 22:55
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@VassilisPallas
VassilisPallas / index.ts
Last active November 25, 2020 03:12
Equivalent to PHP function number_format in Javascript
const assert = require('assert');
const numberFormat = require('./numberFormat');
assert.strictEqual(
numberFormat(132323232320.321, 2, ',', '.'),
'132.323.232.320,32'
);
assert.strictEqual(
numberFormat(10.22),
'10.22'
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active April 16, 2024 20:25
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@stekhn
stekhn / weightedMean.js
Last active November 20, 2022 03:49
Weighted arithmetic mean (average) in JavaScript
function weightedMean(arrValues, arrWeights) {
var result = arrValues.map(function (value, i) {
var weight = arrWeights[i];
var sum = value * weight;
return [sum, weight];
}).reduce(function (p, c) {
@josephspurrier
josephspurrier / AwsController.php
Last active February 24, 2019 15:08
Laravel 5.2 Workflow with Service Providers
<?php
// File Location: projectroot/app/Http/Controllers/AwsController.php
namespace App\Http\Controllers;
use \App;
use \AwsS3;
class AwsController extends Controller
<?php
///////////////////////////////////////////////////
// STEP 1 - CREATE CLASS THAT WILL BE USED GLOBALY
///////////////////////////////////////////////////
namespace App\MyApp;
class MyApp {
public function sayHello($data = [])
{
echo "Hello World from Facade!";
}
@p3t3r67x0
p3t3r67x0 / prefixed-office-properties.md
Last active February 20, 2024 19:15
MS Office prefixed style properties can be used for older versions of MS Excel, MS PowerPoint or MS Word when you want to save a document, presentation, workbook, or worksheet as a web document, or even in older versions for MS Outlook.

MS Office prefixed style properties

mso-ansi-font-size

Note: Office only

mso-ansi-font-size: large | larger | <length> | medium | <percentage> | small | smaller | x-large | x-small | xx-large | xx-small