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
select * from information_schema.COLUMNS | |
where TABLE_SCHEMA = 'schema' | |
and TABLE_NAME = 'table' -- optionally specify the table | |
and IS_NULLABLE = 'NO' -- optionally set to 'YES' to find nullable columns | |
and COLUMN_DEFAULT is null; -- optionally specify columns without a default |
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
-- Lua implementation of PHP scandir function | |
-- special thanks to: | |
-- rhoster (https://stackoverflow.com/users/974053/rhoster) | |
-- ulmangt (https://stackoverflow.com/users/1212363/ulmangt) | |
function scandir(directory) | |
local i, t, popen = 0, {}, io.popen | |
local pfile = popen('ls -a "'..directory..'"') | |
for filename in pfile:lines() do | |
i = i + 1 | |
t[i] = filename |
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
document.querySelector('.datepicker').value = (new Date()).toISOString().substr(0, 10); |
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
select (array['hello', 'world'])[trunc(1 + random() * @len)]; |
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
select elt(floor(1 + (rand() * @len)), "hello", "world", "this", "is", "a", "random", "list"); |
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
with recursive co (id, parent_id, body) as | |
(select c.id, c.parent_id, c.body | |
from comments c | |
where c.id = 1 | |
union all | |
select c.id, c.parent_id, c.body | |
from co | |
join comments c | |
on c.parent_id = co.id) | |
select * from co; |
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
SELECT SUBSTRING_INDEX("first_middle_last", '_', -1); |
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
name: Fluffiness | |
type: theme | |
description: 'A cuddly theme that offers extra fluffiness.' | |
core: 8.x | |
libraries: | |
- fluffiness/global-styling | |
base theme: classy | |
regions: | |
header: Header | |
content: Content |
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
/** | |
* Selects the end of the text in an element. Useful for contenteditable elements. | |
* @param {HTMLElement} target | |
* @return {void} | |
* | |
* note: This function does not support browsers < IE9 | |
*/ | |
export default (target) => { | |
const range = document.createRange(); | |
range.selectNodeContents(target); |
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
#!/bin/bash | |
# Change directory to where you want to create your project. | |
# Composer's create-project command creates a project with | |
# a particular vendor package as the base into a provided directory | |
# You can change the project variable to the | |
# preferred folder name for your project | |
export project="project-name" | |
composer create-project drupal/drupal $project |