This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>X-editable and List.js Datagrid</title> | |
<!-- Bootstrap --> | |
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> |
This file contains 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
// Swap a "main" image by hovering over a thumb image. | |
// They both need to have the same scr, except for the "template" part. | |
$(function () { | |
$( '.thumbimg' ).each( function (i) { | |
$( this ).on({ | |
mouseenter: function() { | |
$('#mainimg').attr( | |
'src', |
This file contains 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 | |
// From http://www.jongales.com/blog/2009/01/27/php-class-for-threaded-comments/ | |
// This modified code now returns an array. | |
class Threaded { | |
public $parents = array(); | |
public $children = array(); | |
This file contains 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
module.exports = { | |
get: function (req, res) { | |
res.sendfile( sails.config.uploaddir + req.param('dir') + '/' + req.param('file') ); | |
}, | |
// List the app-storage directory | |
listdir: function (req, res) { | |
var fs = require('fs'); | |
return res.json( fs.readdirSync(sails.config.uploaddir) ); |
This file contains 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
// http://stackoverflow.com/questions/18313576/confirmation-dialog-on-ng-click-angularjs | |
// http://plnkr.co/edit/YWr6o2?p=preview | |
angular.module('yourApp') | |
.directive('ngConfirmClick', function () { | |
return { | |
link: function (scope, element, attr) { | |
var msg = attr.ngConfirmClick || "Are you sure?"; | |
var clickAction = attr.confirmedClick; | |
element.bind('click',function (event) { |
This file contains 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 | |
function removeDir($path) { | |
// Add trailing slash to $path if one is not there | |
if (substr($path, -1, 1) != "/") { | |
$path .= "/"; | |
} | |
$normal_files = glob($path . "*"); | |
$hidden_files = glob($path . "\.?*"); |
This file contains 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 echo dirname(__FILE__); ?> |
This file contains 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
// Shows an element, and hides it on clicking anywhere in the <body> | |
function toggleOnClick(target) { | |
// Show | |
$(target).fadeIn("fast", function() { | |
$('body').on('click', function() { | |
// Hide on click outside | |
$(target).fadeOut("fast"); | |
}); | |
}); | |
} |
This file contains 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
// SCAFFOLDING | |
// Define gutter width | |
@gutter: 20px; | |
// Some mixins | |
// For clearing floats like a boss h5bp.com/q | |
.clearfix { | |
*zoom: 1; |
OlderNewer