C -> D o D
D -> C
D -> t
D -> D o D
D -> t
Discover gists
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
{var aDone = bDone = cDone = false;} | |
start = part part? | |
part = sets:set* | |
{ | |
var ret = {}; | |
for(var i=0;i<sets.length;i++) { | |
// add to set if it already exists | |
if(ret[sets[i].type] !== undefined) { |
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
{ | |
function styleProps() { | |
// size : style / config | |
return ['className', 'size', 'width', 'disabledLabel', 'textAlign', 'marginRight', 'marginLeft', 'marginTop', 'marginBottom', 'contentSpan']; | |
} | |
function configProps() { | |
return ['htmlType', 'dataSource', 'button', 'value', 'defaultValue', 'placeholder', 'type', 'html', 'autoWidth', 'max', 'min', 'addButtonLabel', 'indexFormat', 'mode', 'data-repeater', 'shape', 'previewHidden']; | |
} | |
function ruleProps() { | |
return ['rule', 'showPath']; |
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
function factorialIterative(num) { | |
var result = 1; | |
for (var i=num; i>0; i--) | |
result *= i; | |
return result; | |
} | |
function factorial(num) { | |
if (num == 0) | |
return 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
//option 1: define as a object | |
var myFn = { | |
duplicate: function(str, num) { | |
num = num || 2; | |
return (new Array(num + 1)).join(str); | |
}, | |
reverse: function(str) { | |
return str.split("").reverse().join(""); | |
}, | |
chop: function(str, index, 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
var getConfigDirectory = function () { | |
var platform = process.platform; | |
if (platform === 'linux') { | |
return process.env.XDG_CONFIG_HOME || path.join(home(), '.config') | |
} | |
else if (platform === 'darwin') { | |
return path.join(home(), 'Library', 'Preferences'); | |
} | |
else if (platform === 'win32') { |
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
//https://pegjs.org/online | |
start = table / trx | |
table = "table" space s:schema "." t:tablename ":" space a:action ":" d:data {return {schema:s, table:t, action:a, data:d};} | |
trx = trx_begin / trx_commit | |
trx_begin = "BEGIN" id:trx_id? {return {trx:"BEGIN", xid:id};} | |
trx_commit = "COMMIT" id:trx_id? tm:trx_tm {return {trx:"COMMIT", xid:id, time:tm};} |
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
IniFile | |
= first: Section (BlankLine* others: Section*) {others.unshift(first); return others; } | |
Section | |
= section: SectionHeader "\n" values: KeyValues* {return {section:values}} | |
SectionHeader | |
= "[" section_name: word "]" {return section_name} | |
KeyValues | |
= a: word "=" value: word "\n"? {var o = {}; o[a]=value; return o;} |
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
Content = (DocType / Comment / BalancedTag / SelfClosingTag / Text)* | |
DocType = "<!doctype " doctype:[^>]* ">" { | |
return { | |
type: 'DocType', | |
content: doctype.join('') | |
}; | |
} | |
Comment = "<!--" c:(!"-->" c:. {return c})* "-->" { |
Postgres 15 is just out, and while there is a lot to love about this new release, you're in for a surprise if you try to set it up with Django following tutorials like this one.
The reason is stated in the release announcement:
Remove PUBLIC creation permission on the public schema (Noah Misch) The new default is one of the secure schema usage patterns that Section 5.9.6 has recommended...
Provided your web app doesn't access your database as a superuser (it shouldn't) and uses a dedicated user, it is not allowed to use the public schema anymore. You have to create one for this specific user, and the next section will
NewerOlder