Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / README
Created January 6, 2012 10:52
CSS BG Pattern
Testing
@mmhan
mmhan / dabblet.css
Created January 6, 2012 20:20 — forked from anonymous/dabblet.css
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
html, body{
height: 100%;
}
.content_botbg{
background: #eeeeee;
background: -moz-linear-gradient(top, #eeeeee 0%, #ededed 16%, #e5e5e5 43%, #dddddd 57%, #d0d0d0 73%, #d0d0d0 75%, #cccccc 77%, #b7b7b7 100%);
@mmhan
mmhan / database.h
Created January 31, 2012 03:44
Sample Database
//
// Database.h
// ChanelVIP
//
// Created by Mike Han on 1/12/12.
// Copyright (c) 2012 Comwerks Interactive. All rights reserved.
//
#import <Foundation/Foundation.h>
SELECT `p`.`code`, `p`.`building_num`, `w`.`building_number`, `s`.`name`, `b`.`name` FROM postcodes AS `p`
LEFT JOIN `streets` AS `s` ON (`p`.`street_key` = `s`.`id`)
LEFT JOIN `buildings` AS `b` ON (`p`.`building_key` = `b`.`id`)
LEFT JOIN `walkups` AS `w` ON (`w`.`postalcode` = `p`.`code`);