Skip to content

Instantly share code, notes, and snippets.

@mmhan
mmhan / README
Created January 6, 2012 10:52
CSS BG Pattern
Testing
@mmhan
mmhan / controller.php
Created November 24, 2011 22:16
Editing multiple records with saveAll()
function edit() {
if(!empty($this->data)) {
$this->Profile->saveAll($this->data['Profile']);
}
else {
$this->data['Profile'] = Set::combine($this->Profile->find('all'), '{n}.Profile.id', '{n}.Profile');
}
}
@mmhan
mmhan / TestIt.java
Created October 20, 2011 13:44
Inner class accessing outer class
/***
* http://www.java-forums.org/java-tips/6296-inner-class-accessing-outer-class.html
**/
public class TestIt {
public static void main(String a[]){
new TestIt().doit();
/*
output :
Hello world!
@mmhan
mmhan / index.htm
Created October 3, 2011 10:12 — forked from anonymous/script.js
Basic Structure For JS
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Lorem ipsum</title>
</head>
<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>window.jQuery || document.write("<script src='js/libs/jquery-1.6.2.min.js'>\x3C/script>")</script>
@mmhan
mmhan / script.js
Created September 27, 2011 02:51 — forked from anonymous/script.js
base modular pattern for script.js
bizintel = {
/** Should give a brief overview of what kinda scripts are running on this site **/
init: function(){
//call function accordingly
banner.init();
new.init();
},
banner:{
config:{
@mmhan
mmhan / javascript_in_php
Created September 26, 2011 08:37 — forked from Djuki/javascript_in_php
Mix javascript and php
$javascript = <<<JS
function javascriptFunction()
{
/* Some javascript code here */
}
JS;
@mmhan
mmhan / ratio.js
Created September 26, 2011 07:57
will dynamically resize the object to a ratio specified in "#videoratio"
$(function(){
var ratioEl = $("#videoratio");
if(ratioEl){
var ratio = ratioEl.html().split(':');
$("#dnn_dnnARTICLE_aembed object").attr('height', 500 * ratio[1] / ratio[0]);
}
});
@mmhan
mmhan / demo.html
Created September 21, 2011 12:00
Video Player embed tag
<html>
<head>
<title>Video Player</title>
</head>
<body>
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="640" height="480">
<param name="source" value="VideoPlayer.xap"/>
<param name="background" value="white" />
<param name="initParams" value="m=http://www.sonypictures.com/movies/21/video/trailer/21_trailer_high.asx" />
@mmhan
mmhan / jquery-1.2.4a.js
Created September 21, 2011 08:54
jquery 1.2.4a and jquery-ui-all-1.5b2 (packed) with detection for better version before loading
(!window.jQuery || window.jQuery().jquery < '1.2.4a') && /** detect if a better jquery is there before loading. If better jquery is there stop loading to avoid conflicts **/
(function(){if(window.jQuery){var _jQuery=window.jQuery;}var jQuery=window.jQuery=function(selector,context){return new jQuery.prototype.init(selector,context);};if(window.$){var _$=window.$;}window.$=jQuery;var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;var isSimple=/^.[^:#\[\.]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}else{if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1]){selector=jQuery.clean([match[1]],context);}else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3]){return jQuery().find(selector);}else{this[0]=elem;this.length=1;return this;}}else{selector=[];}}}else{return new jQuery(context).find(selector);}}else{if(jQuery.isFunction(
@mmhan
mmhan / cw_player.js
Created May 18, 2011 03:01
CWPlayer, Comwerks' Silverlight Videoplayer using http://slvideoplayer.codeplex.com/
(function($){
$.fn.CwPlayer = function(options){
var settings = {
'thumbs' : 'cwVidThumb',
'width' : 640,
'height' : 360,
'source' : ''
};
function getVideoTemplate(url, options){