Skip to content

Instantly share code, notes, and snippets.

View LasMD's full-sized avatar
🏠
Working from home, enjoing a cup with JS and Java, Green Coding 🌴

Lasitha Denipitiya LasMD

🏠
Working from home, enjoing a cup with JS and Java, Green Coding 🌴
View GitHub Profile
@LasMD
LasMD / XML
Created December 22, 2012 03:30
this is a code for making an XML sheet by using a loop . the vector passed for the loop comes from a different location with a static number of values(5 values all the time). after finishing the work all the elements were removed from the vector .. Kindly debug this code
public synchronized String xmlWrite(String rootEle){
sb.delete(0,sb.length());
StringBuffer append = sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").append("<").append(rootEle).append(">");
String s="";
for(int i=0;i<v.size();i++){
s=s.concat("<vectorData>"+(String)v.elementAt(i)+"</vectorData>");
}
append.append(s);
append.append("</").append(rootEle).append(">");
String s2=append.toString();
@LasMD
LasMD / cv1_pred.sql
Created May 5, 2016 02:01 — forked from puyokw/cv1_pred.sql
td_intern rossmann
WITH test_cv1 as(
select
*
from
train_cv where gid=1
) INSERT OVERWRITE TABLE cv1
SELECT
t2.rowid,
t3.sales,
EXP(predicted)-1 as predicted
@LasMD
LasMD / Article.md
Created September 13, 2017 21:11 — forked from Warry/Article.md
How to make faster scroll effects?

How to make faster scroll effects?

  • Avoid too many reflows (the browser to recalculate everything)
  • Use advanced CSS3 for graphic card rendering
  • Precalculate sizes and positions

Beware of reflows

The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows:

@LasMD
LasMD / what-forces-layout.md
Created September 18, 2017 08:29 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@LasMD
LasMD / iPhone-6-plus.css
Created September 20, 2017 13:52
iPhone 6 Plus & iPad Air 2 media query (Retina HD displays). Also works for similar Android devices.
/* iPhone 6 Plus & iPad Air 2 media query (Retina HD displays).
Also works for similar Android devices. */
/* Use x2 images by default. */
.logo {
background-image: url(http://hellyeah.is/images/text-logo-ns@x2.png);
height: 300px;
width: 100%;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
@LasMD
LasMD / high-dpi-media.css
Created September 20, 2017 13:52 — forked from marcedwards/high-dpi-media.css
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@LasMD
LasMD / font-smoothing-on-high-dpi-media.css
Created September 20, 2017 13:58 — forked from dpschen/font-smoothing-on-high-dpi-media.css
Use more beautiful font smoothing on high dpi media devices
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@LasMD
LasMD / Java8DateTimeExamples.java
Created January 18, 2018 04:42 — forked from mscharhag/Java8DateTimeExamples.java
Examples for using the Java 8 Date and Time API (JSR 310)
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import static java.time.temporal.TemporalAdjusters.*;
public class Java8DateTimeExamples {
@LasMD
LasMD / meta-tags.md
Created March 16, 2018 07:00 — forked from kevinSuttle/meta-tags.md
List of Usable HTML Meta and Link Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@LasMD
LasMD / dom-helper.js
Created October 16, 2018 18:06 — forked from SitePointEditors/dom-helper.js
Mini jQuery, sort of.
/**
* A collection of helper prototype for everyday DOM traversal, manipulation,
* and event binding. Sort of a minimalist jQuery, mainly for demonstration
* purposes. MIT @ m3g4p0p
*/
window.$ = (function (undefined) {
/**
* Duration constants
* @type {Object}