Skip to content

Instantly share code, notes, and snippets.

@jurberg
jurberg / drop_constraints.sql
Created November 28, 2012 02:14
Drop all table constraints in Oracle
-- Drop all table constraints:
BEGIN
FOR c IN
(SELECT c.owner, c.table_name, c.constraint_name
FROM user_constraints c, user_tables t
WHERE c.table_name = t.table_name
AND c.status = 'ENABLED'
ORDER BY c.constraint_type DESC)
LOOP
dbms_utility.exec_ddl_statement('alter table "' || c.owner || '"."' || c.table_name || '" disable constraint ' || c.constraint_name);
@jurberg
jurberg / advice.js
Last active December 27, 2015 09:19
sample advice extension. forgot the origins of this...
(function (exports) {
//usage
//withAdvice.call(targetObject);
//mixin augments target object with around, before and after methods
//method is the base method, advice is the augmenting function
exports.withAdvice = function() {
['before', 'after', 'around'].forEach(function(m) {
this[m] = function(method, advice) {
if (typeof this[method] == 'function') {
<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="main"/>
<title>Javascript Components</title>
</head>
<body>
<button onclick="TestDialog.openDialog();">OpenDialog</button>
<g:render template="/layouts/test-dialog"/>
</body>
var TestDialog = (function($) {
var $dialog;
$(function() {
$dialog = $('#test-dialog');
$dialog.dialog({
autoOpen: false,
width: 300,
height: 200
.test-dialog-content {
font-weight: normal;
color: red;
}
modules = {
application {
resource url:'js/application.js'
}
test_dialog {
dependsOn 'jquery, jquery-ui'
resource url:'css/testDialog.css'
resource url:'js/testDialog.js'
}
}
<r:require module="test_dialog"/>
<div id="test-dialog" title="Test Dialog">
<div class="test-dialog-content">
This is a test.
</div>
</div>
UrlMappings.config.forEach(function(mapping) {
app[mapping.verb](mapping.route, function(req, res) {
require(['app/controller/' + mapping.controller], function(Controller) {
Controller[mapping.action](req, res);
});
});
});
app.all('/:controller/:action/:id?', function(req, res) {
require(['app/controller/' + req.params.controller], function(Controller) {
Controller[req.params.action](req, res);
});
});
app.all('/:controller', function(req, res) {
require(['app/controller/' + req.params.controller], function(Controller) {
Controller.index(req, res);
});
<a onclick="view.person.showPerson(); return false;">Show person</a>
<div id="person-div"></div>