Skip to content

Instantly share code, notes, and snippets.

View sairion's full-sized avatar
⚛️

Jaeho Lee (Jay) sairion

⚛️
View GitHub Profile
@sairion
sairion / jquery.js
Created February 3, 2014 04:54 — forked from rwaldron/jquery.js
/*!
* jQuery JavaScript Library v2.1.1pre
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
http://www.kobold2d.com/pages/viewpage.action?pageId=2654212
https://developer.apple.com/library/ios/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html
http://rypress.com/tutorials/objective-c/properties.html
http://enroyed.com/ios/delegation-pattern-in-objective-c-and-writing-custom-delegates/
http://www.oodesign.com/observer-pattern.html
http://www.otierney.net/objective-c.html#constructors

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@sairion
sairion / Object.prototype.inheritedProperty.js
Created April 5, 2014 15:59
Object.prototype.inheritedProperty
/*
* Check if a property is inherited one.
*/
Object.prototype.inheritedProperty = function(Key){
var obj = this;
return (!obj.hasOwnProperty(Key) && (Key in obj))
}
@sairion
sairion / prototype-chaining.js
Last active August 29, 2015 13:58
Very basic chaining prototype
var foo = function(a,b){
this.x = a;
}
foo.prototype.add = function(adder){
console.log('I added '+adder+' to '+this.x+' so it is now '+(this.x+adder));
this.x += adder;
return this;
};
var bar = new foo(1);
@sairion
sairion / quick-sort.js
Last active August 29, 2015 13:58
quick-sort.js
var quickSort = function(arr, len){
//init
if(arr.length <= 1) throw new TypeError('Array should have at least more than one element to sort.');
//loops
for(){
}
//swap function to be used in partition function.
@sairion
sairion / javascript_module.js
Last active August 29, 2015 13:58
javascript_module.js
(function(_public){
//this private var will be only available in simulated IIFE block scope.
var _private = {};
//simulated 'public' method will be exported using _public local var.
_public.counter = (function(){
//init var
var count_no = 0;
//public method
@sairion
sairion / inspect-in-qwebview.py
Last active August 29, 2015 14:00
QWebView에서 Inspect 켜기
from PySide.QtWebKit import QWebView, QWebSettings
self.webview.settings().globalSettings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
Array.prototype.search = function search(value){
var array = this;
if(array.length === 0) return;
for(var index=0; index<array.length; index++){
if (array[index] === value) {
return {
value: array[index],
index: index,
array: array
@sairion
sairion / *args in python.py
Created May 10, 2014 11:45
*args in python.py
def asdf(*args):
print args
# with star supplied in function (args extended)
def asdf_2(*args):
asdf(1, 2, *args)
# without star supplied in function (args come as list)
def asdf_3(*args):
asdf(1, 2, args)