Skip to content

Instantly share code, notes, and snippets.

View frontenddeveloping's full-sized avatar
:octocat:
Code wins arguments

Alexander frontenddeveloping

:octocat:
Code wins arguments
View GitHub Profile
@frontenddeveloping
frontenddeveloping / simple-pagination.js
Created July 27, 2016 07:46 — forked from kottenator/simple-pagination.js
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
<!doctype html public>
<meta charset="utf-8"/>
<title>HTML with venderPackages.dll.js</title>
<body>
<div id="root"></div>
<!-- node_modules/PROJECT-NAME-TEMP-FOLDERNAME-dll/vendorPackages.dll.js generated by postinstall.js running webpack with webpack.dll.config.js -->
<script src="/vendorPackages.dll.js"></script>
<script src="/__build__/bundle.js"></script>
</body>
</html>
@frontenddeveloping
frontenddeveloping / Opinion.md
Created April 7, 2016 09:46 — forked from ALF-er/Opinion.md
ReactJS Conf 2016

Disclaimer 1: Первую которая "про то чего мы достигли" я таки пропустил.

Disclaimer 2: Многие доклады смотрелись и отчёты писались в состоянии алкогольного опьянения.

Сейчас посмотрел Ben Alpert - What Lies Ahead она про то какие идеи они имеют о дальнейшем развитии. И они делят на UX-идеи и DX-идеи. В UX у них:

@frontenddeveloping
frontenddeveloping / fetch-api-wrapper.js
Created October 14, 2015 09:26
Simple fetch API wrapper
(function(global) {
'use strict';
var JSON_TYPE_NAME = 'type';
function getQueryString(queryParams) {
var params = Object.keys(queryParams).map(function(paramName) {
return [paramName, encodeURIComponent(queryParams[paramName])].join('=');
});
return '?' + params.join('&');
@frontenddeveloping
frontenddeveloping / javascript-tabs.html
Last active February 13, 2018 21:08
My example can open many links in tabs, not in new windows. Why need this and do not use window.open? Because there is the problem - if you call once window.open it will open new tab or window(it depends of browser), if will call window.open two or more times - first will open like tab/window and all next in the new window only. The individual b…
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Open 3 tabs</title>
<script src="http://codeorigin.jquery.com/jquery-1.10.2.min.js"></script>
</head>
<body>
<div id="hidden_div"></div>
<script>
@frontenddeveloping
frontenddeveloping / patch-android-studio-check.js
Created October 14, 2018 04:07 — forked from joeljeske/patch-android-studio-check.js
Fixes android plugin install that fail because it cannot find AndroidManifest.xml
/**
* This hook overrides a function check at runtime. Currently, cordova-android 7+ incorrectly detects that we are using
* an eclipse style project. This causes a lot of plugins to fail at install time due to paths actually being setup
* for an Android Studio project. Some plugins choose to install things into 'platforms/android/libs' which makes
* this original function assume it is an ecplise project.
*/
module.exports = function(context) {
if (context.opts.cordova.platforms.indexOf('android') < 0) {
return;
}
@frontenddeveloping
frontenddeveloping / js-micro.js
Created May 17, 2016 19:55 — forked from yuval-a/js-micro.js
Javascript micro-optimizations
// Array literal (= []) is faster than Array constructor (new Array())
// http://jsperf.com/new-array-vs-literal/15
var array = [];
// Object literal (={}) is faster than Object constructor (new Object())
// http://jsperf.com/new-array-vs-literal/26
var obj = {};
// property === undefined is faster than hasOwnProperty(property)
// http://jsperf.com/hasownproperty-vs-in-vs-undefined/17
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml' lang='en'>
<head>
<meta charset='utf-8'/>
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
@frontenddeveloping
frontenddeveloping / pdfjs-file-parser.js
Created January 18, 2016 16:32
Parse uploaded pdf file by PDF.js for number of pages and count links
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.1/es6-shim.js"></script>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
@frontenddeveloping
frontenddeveloping / sw-example.js
Created January 2, 2016 19:23
Service Worker example
var version = 'v2.0.24:';
var offlineFundamentals = [
'/',
'/offline/'
];
//Add core website files to cache during serviceworker installation
var updateStaticCache = function() {
return caches.open(version + 'fundamentals').then(function(cache) {