Example: Reactjs component and calculations: import React from 'react'; type props = { width: number, height: number, frame: { x: number, y: number, w: number, h: number }, textureUrl: string, background?: string, }; class TextureImageResizeComponent extends React.Component<props> { render() { let { width, height, background, frame, textureUrl, } = this.props; if (width === […]
/** * @author Ivan Gospodinow * @site http://ivangospodinow.com/?p=471 * * @param {callback} onUpdate * @return {callback} onStop */ export function countSeconds(onUpdate) { const start = new Date(); const interval = setInterval(() => { onUpdate(parseInt((new Date().getTime() – start.getTime()) / 1000)); }, 1000); return () => { clearInterval(interval); }; } Usage: /** let seconds = 0; […]
Most of the time Zopim chat makes your site slower.Here is an example how you can make your site load faster using Zopim chat. Step 1. Create html page zopim.html and put this code inside: Step 2. Go to the page where you want to put Zopim chat and put this code: That is! It […]
Just use : function isMail(email) { var re = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; return re.test(email); } Simple as that.
onDelay is simple jquery plugin that trigger events with delay. /** * Trigger event delayed. * @author Ivan Gospodinow * @site http://www.ivangospodinow.com * @mail ivangospodinow@gmail.com * @date 01.02.2013 */ (function($) { $.fn.onDelay = function(type, delay, funct) { delay = undefined === delay ? 500 : parseInt(delay); var timeOut; $(this).unbind(type)[type](function(e,x,y,z) { clearTimeout(timeOut); var self = this; […]