Skip to content

Instantly share code, notes, and snippets.

View cristianciofu's full-sized avatar

Cristian CIOFU cristianciofu

  • Strasbourg, France
View GitHub Profile
@cristianciofu
cristianciofu / sl_snippet_8657643.xml
Created November 11, 2013 10:58
SublimeText : add jquery snippet Shortcut ==> script:jq[TAB]
<snippet>
<content><![CDATA[
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
]]></content>
<tabTrigger>script:jq</tabTrigger>
<scope>text.html</scope>
</snippet>
@cristianciofu
cristianciofu / childDIVdata.js
Created November 6, 2013 09:40
Get data for all DIVs inside a DIV
$("#parentId").children().each(function(n, i) {
console.log(this.id); // to get the id of the element
console.log($(this).data('name')); // to access data elements - jQuery style
});
@cristianciofu
cristianciofu / bookmarks.xml
Created October 9, 2013 07:37
Radio Tray Radios (Romania + France + Others)
<bookmarks>
<group name="root">
<group name="Romania">
<bookmark name="Europa FM" url="http://www.europafm.ro/&amp;files/live.m3u"/>
<bookmark name="Kiss FM" url="http://80.86.106.136/listen.pls"/>
<bookmark name="Magic FM" url="http://80.86.106.35:9000/listen.pls"/>
<bookmark name="ProFM" url="http://stream.profm.ro:8012/profm.mp3.m3u"/>
<bookmark name="ProFM Oldies" url="http://stream.profm.ro:8222/oldies.mp3.m3u"/>
<bookmark name="ProFM Classic" url="http://stream.profm.ro:8082/clasic.mp3.m3u"/>
<bookmark name="ProFM Jazz" url="http://stream.profm.ro:8212/jazz.mp3.m3u"/>
@cristianciofu
cristianciofu / exfat_fix
Created September 28, 2013 10:10
Fix for error : Unknown filesystem type 'exfat'
sudo apt-add-repository ppa:relan/exfat
sudo apt-get update
sudo apt-get install fuse-exfat
@cristianciofu
cristianciofu / test892652.js
Created September 17, 2013 13:09
enable / disable dropdown
$(document).ready(function() {
$("#chkdwn2").click(function() {
if ($(this).is(":checked")) {
$("#dropdown").prop("disabled", true);
} else {
$("#dropdown").prop("disabled", false);
}
});
});
@cristianciofu
cristianciofu / PDO_charset.php
Created August 8, 2013 08:08
PHP PDO: charset - excellent if working with french characters
<?php
$connect = new PDO(
"mysql:host=$host;dbname=$db",
$user,
$pass,
array(
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"
)
);
@cristianciofu
cristianciofu / twoDBFieldUpdater.sql
Created July 19, 2013 13:41
In case you'll ever need to update a field from a table with a value that's on a different table
UPDATE TABLE1
INNER JOIN TABLE2 ON (TABLE1.field = TABLE2.field)
SET TABLE1.fieldToChange = TABLE2.fieldNewValue
@cristianciofu
cristianciofu / searchConstraint
Created July 19, 2013 08:55
Find where a primary key is used as a foreign key
USE information_schema;
SELECT * FROM KEY_COLUMN_USAGE
WHERE
REFERENCED_TABLE_NAME = 'YOUR_TABLE_NAME'
AND
REFERENCED_COLUMN_NAME = 'YOUR_FIELD';
@cristianciofu
cristianciofu / reset_auto_increment.sql
Created July 1, 2013 12:55
Reset AUTO_INCREMENT value in MySQL
ALTER TABLE tablename AUTO_INCREMENT = 1
@cristianciofu
cristianciofu / jTableCascade.js
Last active December 19, 2015 02:29
jTable Dropdowns in Cascade
<script>
// ...
id_famille: {
title: 'Family',
list: true,
create: true,
edit: true,
options: { '1': 'Fam_1', '2': 'Fam_2', '3': 'Fam_3' }
},
id_liste: {