Skip to content

Instantly share code, notes, and snippets.

View Nagibaba's full-sized avatar
💭
Bilmək olmaz

Babak Naghiyev Nagibaba

💭
Bilmək olmaz
  • Azerbaijan
View GitHub Profile
@Nagibaba
Nagibaba / placeholder-svg.php
Created April 20, 2018 19:48 — forked from james2doyle/placeholder-svg.php
Create simple placeholder images using SVG
<?php
// Usage: <img src="placeholder-svg.php?wh=400x400&fill=bada55&color=000000&font=Georgia&size=20" />
$wh = explode('x', $_GET['wh']);
$wh[0] = (int)$wh[0];
$wh[1] = (int)$wh[1];
$fill = isset($_GET['fill']) ? $_GET['fill']: '666666';
$color = isset($_GET['color']) ? $_GET['color']: 'FFFFFF';
$size = isset($_GET['size']) ? (int)$_GET['size']: 60;
$fontfamily = isset($_GET['font']) ? $_GET['font']: 'Arial';
header('Content-Type: image/svg+xml');
@Nagibaba
Nagibaba / azercell-landing-1.markdown
Last active May 1, 2018 09:22
Azercell Landing 1
@Nagibaba
Nagibaba / azercell-landing-page-v3.markdown
Last active July 23, 2018 12:58
Azercell landing page v3
'use strict';
/*
# Javascript Prototyping Best Practices
* To create a class, create a constructor function with a `Name` and assign
it to a variable of the same `Name`.
* In this constructor only define properties using `this.prop` notation
@Nagibaba
Nagibaba / asynchronous.js
Created April 11, 2019 13:28 — forked from joepie91/asynchronous.js
PHP vs Node.js: Synchronous vs Asynchronous
console.log("Before the first file is read.");
hypotheticalFileGetContents("sample.txt", function(fileContents){
// fileContents now contains the file contents, this function is only called when the file read in the background has finished
console.log("After the first file has completed reading.");
});
// You've now told it to start the first read, but it won't 'block' your script execution. It will do the read in the background, and immediately move on with the rest of your code.
console.log("Before the second file is read.");
hypotheticalFileGetContents("sample2.txt", function(fileContents){
@Nagibaba
Nagibaba / React Native Clear Cache
Created July 19, 2019 08:06 — forked from jarretmoses/React Native Clear Cache
Clearing the Cache of your React Native Project
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": [
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
]
]
@Nagibaba
Nagibaba / JS Speed test of large string compare functions
Last active February 25, 2020 19:56
bitwise search against localCompare on same and different large strings. It will be used for a service worker approach without ETag
/*
Conclusion
On identical strings localCompare function is pretty fast, but if there is any difference, bitwise search function named "equals" is faster
*/
const CACHE = 'cache-and-update-v2.0.1';
// bitwise
function equals(a, b) {
@Nagibaba
Nagibaba / fizzapay-under-construction.markdown
Created May 27, 2020 12:40
FizzaPay Under construction
@Nagibaba
Nagibaba / EasyTooltip.js
Last active June 3, 2020 08:51
best better docs configuration for React
import React from 'react';
import pt from 'prop-types';
import { Tooltip, OverlayTrigger } from 'react-bootstrap';
/**
* A very expandable component for
* adding tooltip to elements easily.
*
* ```
* <EasyTooltip