Skip to content

Instantly share code, notes, and snippets.

View archangel-irk's full-sized avatar
:octocat:

Konstantin Melnikov archangel-irk

:octocat:
View GitHub Profile
@archangel-irk
archangel-irk / grunt-hash.js
Last active December 23, 2015 21:29
grunt hash (.md5) checksum file for uglify.
uglify: {
production: {
options: {
report: 'min'
},
files: [{
expand: true,
cwd: '<%= dir.tempJS %>/',
src: '*.js',
dest: '<%= dir.publicJS %>',
$._data( $('div').get(0) , 'events'); // get events list
@archangel-irk
archangel-irk / npm-update
Created August 14, 2014 04:26
npm update -g has broken npm enoent
curl -L http://npmjs.org/install.sh | sudo sh
var a = 10;
function testFn() {
alert( a );
alert( b );
}
(function (funArg) {
var a = 20;
var b = 30;
funArg(); // что тут будет и почему?
@archangel-irk
archangel-irk / conf.js
Created September 10, 2015 05:33
js chart conf
var data = new anychart.data.set([
{x: 'Department Stores', value: 637166, marker: {enabled: true, type: 'star5', fill: 'gold'}},
{x: 'Discount Stores', value: 721630},
['Men\'s / Women\'s Specialty Stores', 148662],
['Juvenile Specialty Stores', 78662],
['All other outlets', 90000]
]);
var data2 = new anychart.data.set([
{x: 'Department Stores', value: 657166, marker: {enabled: true, type: 'star5', fill: 'gold'}},
{x: 'Discount Stores', value: 51630},
@archangel-irk
archangel-irk / Copy_AS_versions_snippet.js
Last active March 9, 2017 13:50
Copy AS versions to markdown snippet (See https://github.com/archangel-irk/copy-as-version for new updates)
// Just for information of this snippet.
var ASCopyVersion = '1.1.0';
// TESTED ON BROWSERS:
// * Chrome 56.0.2924.87
// * Firefox 52.0 - Use Scratchpad in devtools.
// Copying from scratchpad doesn't work, use generated button after versions table.
// * Safari 10.0.3 - Just run snippet from console.
@archangel-irk
archangel-irk / Copy_AS_versions_bookmarklet.js
Last active March 9, 2017 13:49
Copy AS versions to markdown bookmarklet (See https://github.com/archangel-irk/copy-as-version for new updates)
javascript:(function(){'use strict';var ASCopyVersion='1.1.0',logs=document.querySelectorAll('._clipboard_log_');logs.forEach(function(a){a.parentNode.removeChild(a)});var copyButtonId='_mycustom-clipboard-button-id_',isButtonExist=document.getElementById(copyButtonId);isButtonExist&&document.getElementById(copyButtonId).remove();var versionsTable=document.querySelector('.Version_table'),md='',headSeparator='||',bodySeparator='|';function isTableHead(a){return 0==a}function add(a){md+=a}function addSeparator(a){isTableHead(a)?add(headSeparator):add(bodySeparator)}for(var tr,i=0;i<versionsTable.childNodes.length;i++)tr=versionsTable.childNodes[i].childNodes[0],addSeparator(i),tr.childNodes.forEach(function(a){add(a.innerText),addSeparator(i)}),md+='\n';if(''!=md){var button=document.createElement('button');button.id=copyButtonId,button.innerText='Click me to copy versions',button.style='\n margin: 20px 0px;\n height: 60px;\n width: 540px;\n font-size: 20pt;\n ',versionsTable.pare
// ES6 9.2.3.2 Function.prototype.bind(thisArg , ...args)
function FunctionBind(this_arg) { // Length is 1.
if (!IS_CALLABLE(this)) throw MakeTypeError(kFunctionBind);
var boundFunction = function () {
// Poison .arguments and .caller, but is otherwise not detectable.
"use strict";
// This function must not use any object literals (Object, Array, RegExp),
// since the literals-array is being used to store the bound data.
if (!IS_UNDEFINED(new.target)) {
return %NewObjectFromBound(boundFunction);
@archangel-irk
archangel-irk / matchUserAgent.js
Last active April 27, 2017 14:43
Match user agent by list (compare, test, browser version support, check, get version)
// UserAgent list
// http://www.useragentstring.com/pages/useragentstring.php?name=Internet+Explorer
// User-agent string changes (Microsoft)
// https://msdn.microsoft.com/en-us/library/hh869301%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
// Understanding user-agent strings
// https://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx
// Google closure implementation
import hoistStatics from 'hoist-non-react-statics';
import React from 'react';
/**
* Allows two animation frames to complete to allow other components to update
* and re-render before mounting and rendering an expensive `WrappedComponent`.
*/
export default function deferComponentRender(WrappedComponent) {
class DeferredRenderWrapper extends React.Component {
constructor(props, context) {