Skip to content

Instantly share code, notes, and snippets.

@webkenny
webkenny / dropzone.js
Created June 17, 2016 06:31
Using Dropzone with Bootstrap
$(document).ready(function () {
var previewNode = document.querySelector("#template");
previewNode.id = "";
var previewTemplate = previewNode.parentNode.innerHTML;
previewNode.parentNode.removeChild(previewNode);
var eventsDropzone = new Dropzone(document.body, {
// The configuration we've talked about above
thumbnailWidth: 80,
@alvesdouglaz
alvesdouglaz / HTML5_player.html
Last active May 27, 2023 16:04
Pseudo Streaming MP4’s with PHP
<video controls="" width="400">
<source src="http://66.128.61.175/reel/1cc976948e74aa62f7a7fde16e64fb6b/360p" type="video/mp4">
Your browser does not support HTML5 video.
</video>
$.fn.select2.amd.define('select2/data/extended-ajax',['./ajax','../utils','jquery'], function(AjaxAdapter, Utils, $){
function ExtendedAjaxAdapter ($element,options) {
//we need explicitly process minimumInputLength value
//to decide should we use AjaxAdapter or return defaultResults,
//so it is impossible to use MinimumLength decorator here
this.minimumInputLength = options.get('minimumInputLength');
this.defaultResults = options.get('defaultResults');
ExtendedAjaxAdapter.__super__.constructor.call(this,$element,options);
@bergonzzi
bergonzzi / index.html
Last active July 21, 2021 13:37
DataTables + yadcf + maplace.js - load the table and the map from the same data source and update the map automatically when filtering
<html>
<head>
<title>DataTables + yadcf + Google Maps</title>
<script type="text/javascript" charset="utf8" src="http://maps.google.com/maps/api/js?libraries=geometry&v=3.22&key={YOUR_API_KEY}"></script>
<script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script type="text/javascript" charset="utf8" src="http://cdn.datatables.net/1.10.11/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.11/js/dataTables.bootstrap.min.js"></script>
<script type="text/javascript" charset="utf8" src="maplace.min.js"></script>
<script type="text/javascript" charset="utf8" src="jquery.dataTables.yadcf.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
#!/bin/bash
TIMENAME=`date +%d.%m.%Y-%H.%M`
for dbname in `echo show databases| mysql -u root`; do
if [ $dbname != "Database" ] && [ $dbname != "mysql" ] && [ $dbname != "information_schema" ] && [ $dbname != "performance_schema" ]; then
echo "Dump $dbname..."
mysqldump -u root $dbname > "/var/www/mysql/$dbname.sql"
fi
done;
@finalwebsites
finalwebsites / create-form-fields.php
Created March 29, 2016 06:09
Create form fields with PHP
<?php
function create_form_field($formelement, $label = "", $db_value = "", $length = 25) {
$form_field = ($label != "") ? "<label for=\"".$formelement."\">".$label."</label>\n" : "";
$form_field .= " <input name=\"".$formelement."\" type=\"text\" size=\"".$length."\" value=\"";
if (isset($_REQUEST[$formelement])) {
$form_field .= $_REQUEST[$formelement];
} elseif (isset($db_value) && !isset($_REQUEST[$formelement])) {
$form_field .= $db_value;
} else {
$form_field .= "";
@jdsimcoe
jdsimcoe / base64.md
Created October 16, 2015 23:03
A guide to how to embed Base64 stuff in your web stuff.

HTML

Here is some code on how to embed Base64 in HTML:

JPEG

<img src="data:image/jpeg;base64,BASE64_STRING"/>

PNG

@billycsete
billycsete / hasParent.js
Created September 22, 2015 22:24
Find out if an element is the parent of another element
function hasParent( e, p ) {
if ( !e ) return false;
var el = e.target || e.srcElement || e || false;
while ( el && el != p ) {
el = el.parentNode || false;
}
return ( el!==false );
}
@billycsete
billycsete / scrollTo.js
Last active May 11, 2016 12:32
Animate scroll to element function
// first add raf shim
// http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function( callback ){
window.setTimeout(callback, 1000 / 60);
};
})();
@jackyliang
jackyliang / Owl Carousel URL Hash Auto Update
Last active May 11, 2016 12:28
An Owl Carousel demo with auto-updating URL hash