Skip to content

Instantly share code, notes, and snippets.

View krishna2nd's full-sized avatar
🎯
Focusing

Krishna krishna2nd

🎯
Focusing
View GitHub Profile
function arrFlatern(inArray) {
return inArray.reduce(function (_in, to) {
return _in.concat(Array.isArray(to) ? arrFlatern(to) : to);
}, []);
}
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@krishna2nd
krishna2nd / express
Created February 8, 2017 05:57
Generate certificates for http2-express
$ mkdir http2-express
$ cd http2-express
$ openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
...
$ openssl rsa -passin pass:x -in server.pass.key -out server.key
writing RSA key
$ rm server.pass.key
$ openssl req -new -key server.key -out server.csr
...
Country Name (2 letter code) [AU]:US
@krishna2nd
krishna2nd / UnityLoader.js
Created March 16, 2017 03:17
Web Assembly
var UnityLoader = UnityLoader || {
compatibilityCheck: function(e, t, r) {
UnityLoader.SystemInfo.hasWebGL ? UnityLoader.SystemInfo.mobile ? e.popup("Please note that Unity WebGL is not currently supported on mobiles. Press OK if you wish to continue anyway.", [{
text: "OK",
callback: t
}]) : ["Firefox", "Chrome", "Safari"].indexOf(UnityLoader.SystemInfo.browser) == -1 ? e.popup("Please note that your browser is not currently supported for this Unity WebGL content. Press OK if you wish to continue anyway.", [{
text: "OK",
callback: t
}]) : t() : e.popup("Your browser does not support WebGL", [{
text: "OK",

Opera Mini OBML file format

© 2016 Mantas Mikulėnas [email protected]

This documentation is released under CC BY 4.0.


OBML (Opera Binary Markup Language) files are self-contained, rendered versions of HTML documents generated by the Presto v2 engine. They are static, containing pixel-positioned regions adapted for a specific device's screen size & font metrics. (Thus OBML documents generated for one device tend to look slightly 'off' everywhere else, and a perfect rendering is impossible without knowing the original device.)

const out = {
userSucc: {
succ: true,
t: 200,
value: {
name: "krishna",
age: 20
}
},
userError: {
let target = {
foo: "Welcome, foo"
}
let proxy = new Proxy(target, {
get (receiver, name) {
// get value from target if proprty exists else some logic from proxy
return name in receiver ? receiver[name] : `Hello, ${name}`
},
// set value to target by adding new property
set (receiver, name, value) {

ECMAScript 5 Strict Mode, JSON, and More Previously I analyzed ECMAScript 5’s Object and Property system. This is a huge new aspect of the language and deserved its special consideration.

There are a number of other new features and APIs that need attention, as well. The largest of which are Strict Mode and native JSON support.

Strict Mode Strict Mode is a new feature in ECMAScript 5 that allows you to place a program, or a function, in a “strict” operating context. This strict context prevents certain actions from being taken and throws more exceptions (generally providing the user with more information and a tapered-down coding experience).

Since ECMAScript 5 is backwards-compatible with ECMAScript 3, all of the “features” that were in ECMAScript 3 that were “deprecated” are just disabled (or throw errors) in strict mode, instead.

// Parentheses pairing ({}[]()<>)
//
package main;
import (
"fmt"
"strings"
)
func main() {
fmt.Println(stringMatch("{[(])}"));
package main;
import (
"fmt"
)
func main() {
var val = []int{ 1,2 ,3 ,4 ,115 ,6 ,17 ,8 ,9 };
var l1, l2 int = val[0], 0;
for _, v := range val {
if (l1 < v) {