Skip to content

Instantly share code, notes, and snippets.

Avatar

Krzysztof Koziarski kkoziarski

View GitHub Profile
@kkoziarski
kkoziarski / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kkoziarski
kkoziarski / javascript_resources.md
Last active Aug 29, 2015 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.
View javascript_resources.md

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@kkoziarski
kkoziarski / css_resources.md
Last active Aug 29, 2015 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.
View css_resources.md

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@kkoziarski
kkoziarski / CustomConvert.cs
Created Nov 27, 2014
Convert To CSV & Excel
View CustomConvert.cs
//NPOI.dll
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using System.Data;
using System.Reflection;
using NPOI.HSSF.UserModel;
using NPOI.HSSF.Util;
View isnumber.js
function isInt(input) {
return !isNaN(input) && parseInt(input) == input;
//(parseFloat(value) == parseInt(value))
}
function isNumber(input) {
return !isNaN(parseFloat(input)) && isFinite(input);
}
View generate-guid.js
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
function guid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
@kkoziarski
kkoziarski / Object.create.js
Last active Aug 29, 2015
Object.create - The Good Parts
View Object.create.js
//The method creates a new object that uses an old object as its prototype.
if (typeof Object.create !== 'function') {
Object.create = function (o) {
var F = function () {};
F.prototype = o;
return new F();
};
}
var another_stooge = Object.create(stooge);
@kkoziarski
kkoziarski / parse-url.js
Created Nov 28, 2014
Parse URL parts - The Good Parts
View parse-url.js
var parse_url = /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/;
var url = 'http://www.ora.com:80/goodparts?q#fragment';
var result = parse_url.exec(url);
var names = ['url', 'scheme', 'slash', 'host', 'port', 'path', 'query', 'hash'];
var blanks = ' ';
var i;
for (i = 0; i < names.length; i += 1) {
document.writeln(names[i] + ':' + blanks.substring(names[i].length), result[i]);
}
@kkoziarski
kkoziarski / exceptions.js
Last active Aug 29, 2015
Exceptions - The Good Parts
View exceptions.js
var add = function (a, b) {
if (typeof a !== 'number' || typeof b !== 'number') {
throw {
name: 'TypeError',
message: 'add needs numbers'
};
}
return a + b;
}
@kkoziarski
kkoziarski / Function.prototype.method.js
Last active Aug 29, 2015
Function.prototype.method - The Good Parts
View Function.prototype.method.js
Function.prototype.method = function (name, func) {
this.prototype[name] = func;
return this;
};
// Add a method conditionally.
Function.prototype.method = function (name, func) {
if (!this.prototype[name]) {
this.prototype[name] = func;
}