Skip to content

Instantly share code, notes, and snippets.

Om Shankar OmShiv

Block or report user

Report or block OmShiv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@OmShiv
OmShiv / components.component-five.js
Created Jun 11, 2018
Ember Components and Mixins data leak fix
View components.component-five.js
import ComponentOne from './component-one';
import ComponentA from '../mixins/component-a';
export default ComponentOne.extend(ComponentA, {
type: 'Component Five',
description: 'Extends Component One and includes Component A. Overrides obj in definition.',
obj: {
val: 5
}
});
@OmShiv
OmShiv / components.component-five.js
Created Jun 9, 2018 — forked from neborn/components.component-five.js
Inheritance and Complex Types in Definitions
View components.component-five.js
import ComponentOne from './component-one';
import ComponentA from '../mixins/component-a';
export default ComponentOne.extend(ComponentA, {
type: 'Component Five',
description: 'Extends Component One and includes Component A. Overrides obj in definition.',
obj: {
val: 5
}
});
View progress-bar.html
<!DOCTYPE html>
<html>
<head>
<title>Progress Bar</title>
</head>
<style type="text/css">
#progress-bar {
background-color: blue;
height: 30px;
border-radius: 2px;
@OmShiv
OmShiv / vertical-horizontal-center.html
Last active Aug 29, 2015
Vertical Horizontal Center
View vertical-horizontal-center.html
<div class="outer">
<div class="middle">
<div class="inner">
<h1>The Content</h1>
<p>Once upon a midnight dreary...</p>
</div>
</div>
</div>
<style>
@OmShiv
OmShiv / colors.css
Last active Aug 29, 2015
Awesome CSS colors, gradients, etc.
View colors.css
.topics-menu__topic-submenu.topic-design {
background-color: #c42915
}
.topics-menu__topic-submenu.topic-code {
background-color: #005d50
}
.topics-menu__topic-submenu.topic-music {
background-color: #0235c0
@OmShiv
OmShiv / vm-array-functions-dump.js
Created Dec 28, 2013
Ran a "for ... in " on Array, VM8, Chrome 31.x
View vm-array-functions-dump.js
function (start,length){start=start||0;if(start<0)start=this.length+start;length=length||(this.length-start);var newArray=[];for(var i=0;i<length;i++)newArray[i]=this[start++];return newArray} VM2066:4
function (item){var i=0;var len=this.length;while(i<len){if(this[i]===item){this.splice(i,1);len--}else{i++}}return this} VM2066:4
function (item,from){return this.indexOf(item,from)!=-1} VM2066:4
function (keys){var obj={},length=Math.min(this.length,keys.length);for(var i=0;i<length;i++)obj[keys[i]]=this[i];return obj} VM2066:4
function (array){for(var i=0,j=array.length;i<j;i++)this.push(array[i]);return this} VM2066:4
function (array){for(var i=0,l=array.length;i<l;i++)this.include(array[i]);return this} VM2066:4
function include(object) {
if (Object.isFunction(this.indexOf))
if (this.indexOf(object) != -1) return true;
@OmShiv
OmShiv / oop-exp.js
Last active Dec 22, 2015
Object Oriented Programming in JavaScript
View oop-exp.js
/*** OOP in JS ***/
// No Classes in JavaScript, but constructor functions.
var a = 5;
// is equivalent to calling
var a = Number(5); // JavaScript abstracts it.
// Number is a Constructor Function
// A Class. First letter caps only for symantics
@OmShiv
OmShiv / dzutils.js
Created Apr 6, 2013
Best function bind
View dzutils.js
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
// closest thing possible to the ECMAScript 5 internal IsCallable
// function
if (typeof this !== "function")
throw new TypeError(
"Function.prototype.bind - what is trying to be fBound is not callable"
);
@OmShiv
OmShiv / overlay-pops.html
Last active Dec 14, 2015
Google Chrome - Overlay popups
View overlay-pops.html
<div id="overlay-container-1" class="overlay">
<div id="spelling-confirm-overlay" class="page" hidden="" style="max-height: 351.90000000000003px;">
<div class="close-button"></div>
<h1 i18n-content="spellingConfirmOverlay">Ask Google for Suggestions</h1>
<div class="content-area">
<span id="spelling-confirm-text" i18n-content="spellingConfirmMessage">Google Chrome can provide smarter spell-checking by sending what you type in the browser to Google servers, allowing you to use the same spell-checking technology used by Google search.</span>
<a id="spelling-confirm-learn-more" target="_blank" i18n-content="learnMore" i18n-values="href:privacyLearnMoreURL" href="https://support.google.com/chrome/?p=settings_privacy">Learn more</a>
</div>
<div class="action-area">
<div class="button-strip">
@OmShiv
OmShiv / bin-ajax.js
Last active Dec 14, 2015
Binary data in the OLD Web and the new HTML5 Web, via AJAX
View bin-ajax.js
/*
** OLD
*/
var xhr = new XMLHttpRequest();
xhr.open('GET', '/path/to/image.png', true);
// Trick to pass bytes through unprocessed.
xhr.overrideMimeType('text/plain; charset=x-user-defined')
You can’t perform that action at this time.