This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 관련 테이블 | |
* Start | |
*/ | |
class M_survey extends CI_Model{ | |
function __construct(){ | |
parent::__construct(); | |
$this->db = $this->load->database("global", TRUE); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Start extends CI_Controller { | |
function __construct() { | |
parent::__construct(); | |
$this->data = array(); | |
} | |
public function index() | |
{ | |
$this->main(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="wrap"> | |
<div class="row"> | |
<div class="col-lg-12"> | |
<h3></h3> | |
</div> | |
</div> | |
<hr/> | |
<div> | |
<div class="col-lg-12"> | |
<div class="panel panel-default"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function remove_item(array, element) { | |
const index = array.indexOf(element); | |
if (index !== -1) { | |
array.splice(index, 1); | |
} | |
} | |
// deep copy json | |
JSON.parse(JSON.stringify(object)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Node(data) { | |
this.data = data; | |
this.parent = null; | |
this.children = []; | |
} | |
function Tree(data) { | |
var node = new Node(data); | |
this._root = node; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Node(value) { | |
this.data = value; | |
this.previous = null; | |
this.next = null; | |
} | |
function SinglyList() { | |
this._length = 0; | |
this.head = null; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Stack() { | |
this._size = 0; | |
this._storage = {}; | |
} | |
Stack.prototype.push = function(data) { | |
var size = ++this._size; | |
this._storage[size] = data; | |
}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Queue() { | |
this._oldestIndex = 1; | |
this._newestIndex = 1; | |
this._storage = {}; | |
} | |
Queue.prototype.size = function() { | |
return this._newestIndex - this._oldestIndex; | |
}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
class Hierarchy { | |
private static $hierarchy; | |
private static $lookup; | |
// Nodes can be any objects that have IDs (id) and a parent IDs (parent) | |
public static function buildTree($nodes){ | |
// Initialize hierarchy and lookup arrays | |
self::$hierarchy = array(); | |
self::$lookup = array(); | |
// Walk through nodes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tableToExcel = (function() { | |
var uri = 'data:application/vnd.ms-excel;base64,' | |
, template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><?xml version="1.0" encoding="UTF-8" standalone="yes"?><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>' | |
, base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) } | |
, format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }; | |
return function(table, name) { | |
if (!table.nodeType) table = document.getElementById(table); | |
var ctx = { worksheet: name || 'Worksheet', table: table.innerHTML }; | |
window.location.href = uri + base64(format(template, ctx)); | |
}; |