Skip to content

Instantly share code, notes, and snippets.

iPad
1024 × 690 In landscape on iOS 4.3
1024 × 672 In landscape on iOS 5
768 × 946 In portrait on iOS 4.3
768 × 928 In portrait on iOS 5
1024 × 660 Always showing bookmarks bar in landscape on iOS 4.3
1024 × 644 Always showing bookmarks bar in landscape on iOS 5
768 × 916 Always showing bookmarks bar in portrait on iOS 4.3
@Shavindra
Shavindra / index.html
Created April 14, 2013 21:19
A CodePen by Shavin Fonseka. SASS + Compass test
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8">
@Shavindra
Shavindra / index.html
Created April 14, 2013 23:40
A CodePen by Shavin Fonseka. SASS + Compass test
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8">
public static void whileLoop(){
System.out.println("\nEXAMPLE: While Loop");
int num = 0;
while(num <= 20) { // Check the while condition first, Then execute the loop
// Then while 'l' is less than or equal to '0'
System.out.println("num = " + num);
num++; //increment 'l' by 1
public static void doWhileLoop() {
System.out.println("\nEXAMPLE: Do While Loop");
int num = 0;
do {
// DO the work... Execute the loop first
System.out.println("num = " + num);
num++; //increment 'l' by 1
public static void witchStatment(int num) {
System.out.println("\nEXAMPLE: Switch Statement");
switch(num){ //Check the value
case 0:
System.out.println("Case = " + num); // Execute this if 'case' matches the 'value'
break; // Stop the statement
case 1:
System.out.println("Case = " + num); // Execute this if 'case' matches the 'value'
public static void enhancedForLoop(){
int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9};
System.out.println("\nEXAMPLE: Enhanced For Statement");
for (int temp: arr){ // Create a temporary variable, same type as array values. For
// loop assign array value to the temporary variable
System.out.println("Enhanced = " + temp);
}
@Shavindra
Shavindra / gistMarkdown.js
Last active August 29, 2015 14:27
Dynamically embed Gists in a markdown document
/* USAGE:
* markdown, gist, github, json, embed
* Reference the script in index.html (or main md html file e.g. mdwiki.html)
* Then in any .md document include like below. Ensure empty lines before <div> and after </div>
*
* <div class="gistEmbed" data-gist-id="12265cd979f0dee75acd"></div>
*
*
*/
@Shavindra
Shavindra / Fundamentals - anyNumberOfArguments.js
Last active September 24, 2015 10:50
Fundamentals: get all the arguments in a function
//Function declaration
function foo() {
console.log(arguments);
}
foo(['a', 'b', 'c'], [1, 2, 3, 4, 5]);
//IIFE
(function() {
//uitls.js : CREATE NAMESPACING functions also use ‘define()’ to declare it as requirjs module
(function (requirejs) {
define('utils', function () {
// Allow creation of methods for SHOP modules
window.UTILS = window.UTILS || {};
var u = window.UTILS;