Skip to content

Instantly share code, notes, and snippets.

Maxim Dikun dikmax

View GitHub Profile
@dikmax
dikmax / generator.js
Created Feb 23, 2013
Object inheritance test generator
View generator.js
var fs = require('fs');
var generateBaseClass = function () {
var baseClass = 'var BaseClass=function(){};\n';
for (var i = 1; i <= 100; ++i) {
baseClass += 'BaseClass.prototype.method' + i + '=function(){return ' + i + '}\n';
}
return baseClass;
}
@dikmax
dikmax / test.js
Created Aug 17, 2012
Test compactness
View test.js
NewClass = Class.extend("OptionalDisplayName", {
constructor: function () {},
properties: {
property1: {set: true, get: true, initial: 'Initial value'},
property2: {get: function () { return true; }}
},
statics: {
staticField1: null,
View header.html
<div id="cse" style="width: 100%;">Loading</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
function parseQueryFromUrl () {
var queryParamName = "q";
var search = window.location.search.substr(1);
var parts = search.split('&');
for (var i = 0; i < parts.length; i++) {
var keyvaluepair = parts[i].split('=');
You can’t perform that action at this time.