portalzine / HTMX - Process on DOM changes
0 喜欢
0 派生
1 文件
最后活跃于 5 months ago
| 1 | const observer = new MutationObserver((mutations) => { |
| 2 | mutations.forEach((mutation) => { |
| 3 | mutation.addedNodes.forEach((node) => { |
| 4 | if (node.nodeType === 1 && !node["htmx-internal-data"]) { |
| 5 | htmx.process(node) |
| 6 | } |
| 7 | }) |
| 8 | }) |
| 9 | }) |
| 10 | observer.observe(document, {childList: true, subtree: true}) |
portalzine / Protect access to log and sql files
0 喜欢
0 派生
1 文件
最后活跃于 6 months ago
| 1 | # protect access to log and sql files. |
| 2 | <FilesMatch "\.(log|sql)(\.(t?gz|tar|gz|tar\.gz|7z|rar|bz2))?$"> |
| 3 | <IfModule mod_authz_core.c> |
| 4 | Require all denied |
| 5 | </IfModule> |
| 6 | <IfModule !mod_authz_core.c> |
| 7 | Order deny,allow |
| 8 | Deny from all |
| 9 | </IfModule> |
| 10 | </FilesMatch> |
portalzine / Extract text between two tags (domDocument)
0 喜欢
0 派生
1 文件
最后活跃于 7 months ago
| 1 | $tag = "p"; |
| 2 | $html ="I am here!"; |
| 3 | $dom = new domDocument('1.0', 'utf-8'); |
| 4 | $dom->loadHTML($html); |
| 5 | $dom->preserveWhiteSpace = false; |
| 6 | |
| 7 | $findTag = $dom->getElementsByTagName($tag); |
| 8 | |
| 9 | echo $findTag->item(0)->nodeValue; |
portalzine / Getting the average of an array of numbers
0 喜欢
0 派生
2 文件
最后活跃于 7 months ago
| 1 | $average_of_myfoos = array_sum($myfoos) / count($myfoos); |
portalzine / Codekit - Timestamp Hook
0 喜欢
0 派生
1 文件
最后活跃于 7 months ago
| 1 | NOW=`date "+%a %Y-%m-%d %T"` |
| 2 | sed -i -- "s|{{TIMESTAMP}}|${NOW}|g" $CK_OUTPUT_PATH |
上一页
下一页