recentpopularlog in

kme : webdevel   2567

« earlier  
Curling Quotes in HTML, XML, and SGML
Says don't used the named character entity reference in HTML, but that's just what I did: &ldquo, &rdquo, &lsquo, and &rsquo.
sgml  xml  html  curlyquotes  typography  webdevel  reference 
11 hours ago by kme
html - Howto: div with onclick inside another div with onclick javascript - Stack Overflow
Basically there are two event models in javascript. Event capturing and Event bubbling. In event bubbling, if you click on inside div, the inside div click event fired first and then the outer div click fired. while in event capturing, first the outer div event fired and than the inner div event fired. To stop event propagation, use this code in your click method.

<code class="language-javascript">if (!e) var e = window.event;
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();</code>
webdevel  javascript  eventhandling  capture  bubbling  explained 
6 days ago by kme
html - Can I nest a <button> element inside an <a> using HTML5? - Stack Overflow
No. But I ended up using a variation of, which sets 'onclick="location.href='#anchor'"' instead, then an 'a' element inside as a backup if JS is disabled.
webdevel  html5  button  links  workaround  solution 
6 days ago by kme
columns().nodes() not returning tags? — DataTables forums
I'll post a fuller reply later (on mobile atm) bit what is expected from that method is that it will return th and td cells from inside the tbody for the column. If you want the header cell use column().header().

I've just committed a small change to the docs that clarifies that the nodes returned by this method come from the table body (its important to recall that both td and th cells are valid in both the header and body rows.
webdevel  datatables  thead  sortof  solution 
7 days ago by kme
Simple automated GIT Deployment using Hooks
I'm sure I've got a gist with something like this somewhere else (FIXME).

<code class="language-bash">#!/bin/bash

while read oldrev newrev ref
# only checking out the master (or whatever branch you would like to deploy)
if [ "$ref" = "refs/heads/$BRANCH" ];
echo "Ref $ref received. Deploying ${BRANCH} branch to production..."
git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f $BRANCH
echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server."
git  githooks  deployment  webdevel  devops  automation  reference 
8 days ago by kme
Why did reCAPTCHA get replaced with a clickbox (noCAPTCHA)? - Quora
Secondly, Google (or websites) now have enough personally identifying biometric and other data about internet users that the following CAPTCHA alternative is feasible, via Are you a robot? Introducing “No CAPTCHA reCAPTCHA”:
Last year we developed an Advanced Risk Analysis backend for reCAPTCHA that actively considers a user’s entire engagement with the CAPTCHA—before, during, and after—to determine whether that user is a human. This enables us to rely less on typing distorted text and, in turn, offer a better experience for users. In cases when the risk analysis engine can't confidently predict whether a user is a human or an abusive agent, it will prompt a CAPTCHA to elicit more cues, increasing the number of security checkpoints to confirm the user is valid.
webdevel  recaptcha  biometric  security  fingerprinting  explained 
10 days ago by kme
How do I identify and eliminate unused CSS styles from my bloated stylesheet? - Stack Overflow
<code class="language-bash">npm install uncss -g</code>
<code class="language-bash">uncss > out.css</code>
webdevel  css  minifier  cleaner  commandline  build  toolchain  maybesolution 
13 days ago by kme
SyntaxError: missing : after property id - JavaScript | MDN
ES6 only, FYI.
If you create a property key from an expression, you need to use square brackets. Otherwise the property name can't be computed:
<code class="language-javascript">var obj = { 'b'+'ar': 'foo' };
// SyntaxError: missing : after property id</code>

Put the expression in brackets []:
<code class="language-javascript">var obj = { ['b'+'ar']: 'foo' };</code>
javascript  objects  keys  syntax  errormessage  solution  webdevel  til  es6 
13 days ago by kme
How To Specify Typical Device Breakpoints With Media Queries
<code class="language-css">/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {...}

/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {...}

/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {...}

/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {...}

/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {...}</code>
webdesign  webdevel  breakpoints  css  mediaqueries  solution 
16 days ago by kme
text processing - how to massage or format html in order to parse with xmstarlet? - Unix & Linux Stack Exchange
Pretty key when the input is HTML but not XHTML:
<code class="language-bash">xmlstarlet fo -H -R </code>
xmlstarlet  malformed  html  webdevel  textprocessing  commandline  cli  solution 
19 days ago by kme
text processing - How to parse hundred html source code files in shell? - Unix & Linux Stack Exchange
<code class="language-bash">hxselect '#the_div_id' <file</code>

<code class="language-bash">pup '#the_div_id' < file.html</code>
webdevel  cssselectors  commandline  cli  html  parser  fuckina  alternativeto  xmlstarlet 
19 days ago by kme
Index of /Tools/HTML-XML-utils

<code>cexport (1) - create headerfile of exported declarations from a C file
hxaddid (1) - add ID's to selected elements
hxcite (1) - replace bibliographic references by hyperlinks
hxcite-mkbib (1) - expand references and create bibliography
hxcopy (1) - copy an HTML file while preserving relative links
hxcount (1) - count elements and attributes in HTML or XML files
hxextract (1) - extract selected elements
hxclean (1) - apply heuristics to correct an HTML file
hxprune (1) - remove marked elements from an HTML file
hxincl (1) - expand included HTML or XML files
hxindex (1) - create an alphabetically sorted index
hxmkbib (1) - create bibliography from a template
hxmultitoc (1) - create a table of contents for a set of HTML files
hxname2id - move some ID= or NAME= from A elements to their parents
hxnormalize (1) - pretty-print an HTML file
hxnum (1) - number section headings in an HTML file
hxpipe (1) - convert XML to a format easier to parse with Perl or AWK
hxprintlinks (1) - number links & add table of URLs at end of an HTML file
hxremove (1) - remove selected elements from an XML file
hxtabletrans (1) - transpose an HTML or XHTML table
hxtoc (1) - insert a table of contents in an HTML file
hxuncdata (1) - replace CDATA sections by character entities
hxunent (1) - replace HTML predefined character entities to UTF-8
hxunpipe (1) - convert output of pipe back to XML format
hxunxmlns (1) - replace "global names" by XML Namespace prefixes
hxwls (1) - list links in an HTML file
hxxmlns (1) - replace XML Namespace prefixes by "global names"
asc2xml, xml2asc (1) - convert between UTF8 and &#nnn; entities
hxref (1) - generate cross-references
hxselect (1) - extract elements that match a (CSS) selector
webdevel  cssselectors  commandline  cli  html  parser  alternativeto  xmlstarlet 
19 days ago by kme
Tippy.js - Tooltip and Popover Library
It has a dependency on Popover.js, but not jQuery.
webdevel  popup  popover  tooltip  library  vanillajs 
20 days ago by kme
How To Set Up an Apache, MySQL, and Python (LAMP) Server Without Frameworks on Ubuntu 14.04 | DigitalOcean
<code class="language-apache"><Directory /var/www/test>
Options +ExecCGI
AddHandler cgi-script .py

Also useful:
<code class="language-python">import cgitb; cgitb.enable()
print("Content-Type: text/html; charset=utf-8\n")</code>

Just make sure you send the 'Content-Type' header before you try anything that might produce a traceback, otherwise you get... NOTHING!
pyton  cgi  webdevel  webmaster  solution 
26 days ago by kme
cgi.parse Python Example
The key is those environment variables. I always forget that part.

<code class="language-python">def do_test(buf, method):
env = {}
if method == "GET":
fp = None
env['QUERY_STRING'] = buf
elif method == "POST":
fp = BytesIO(buf.encode('latin-1')) # FieldStorage expects bytes
env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'
env['CONTENT_LENGTH'] = str(len(buf))
raise ValueError("unknown method: %s" % method)
return cgi.parse(fp, env, strict_parsing=1)
except Exception as err:
return ComparableException(err)</code>
dammitbrain  webdevel  python  cgi  testing  solution 
26 days ago by kme
javascript - window.onload vs document.onload - Stack Overflow
Vanilla version currently in style seems to be something like:
<code class="language-javascript">window.addEventListener('load', function() {
console.log('All assets are loaded')
webdevel  javascript  jquery  onload  dammitbrain 
27 days ago by kme
HTTP range requests - HTTP | MDN |
If the Accept-Ranges is present in HTTP responses (and its value isn't "none"), the server supports range requests. You can check this by issuing a HEAD request with cURL, for example.
<code class="language-bash">
curl -I

# result:
# HTTP/1.1 200 OK
# ...
# Accept-Ranges: bytes
# Content-Length: 146515
curl  http  rangerequest  partialdownloads  resume  webdevel  solution  reference 
6 weeks ago by kme
How to set fallback encoding to UTF-8 in Firefox? - Unix & Linux Stack Exchange
<code>uconv --add-signature -f %{charset} -t UTF-8 %s | sponge %s && firefox -new-tab %s & sleep 5</code>
firefox  unicode  bom  maybesolution  webdevel 
9 weeks ago by kme
Automatic App Deployment with "git push" - Benjamin Gleitzman's Blog
When deploying pet projects on remote servers, I dislike the extra step of logging into the remote machine to execute a git pull (and perhaps a server reload) every time I push new code. Sure there’s Jenkins and all sorts of bazooka-like solutions, but this is a knife fight. Poking around an old PHP repo, I found a nifty line of code that will update your app via a URL endpoint.
<code class="language-bash"><?php `git pull`;</code>
Drop that into secret-update-url.php and now all you have to do is visit to get the latest version of your code on the site. Going a step further, you can set up a webhook to have Github hit the URL for you.
webdevel  git  php  deployment  automation  python  flask 
9 weeks ago by kme
javascript - Remove All Event Listeners of Specific Type - Stack Overflow
I ended up binding to 'window.onscroll' and just set 'document.documentElement.scrollTop = 0' each time it fired, which is janky when there are a ton of scroll events queued.

But nothing else--neither 'e.preventDefault()' nor 'e.stopPropagation()'--seemd to work.
webdevel  javascript  eventhandler  mousewheel  scrolling  sortof  workaround  solution 
10 weeks ago by kme
Creating a package.json file | npm Documentation
<code class="language-json">{
"name": "my-awesome-package",
"version": "1.0.0"

<code class="language-bash">npm init</code>
webdevel  javascript  npm  packaging  dammitbrain  solution 
10 weeks ago by kme
Create Your Own Shortcodes | Hugo
Note: you can only use these in your content, *not* inside templates.
webdevel  hugo  shortcodes 
10 weeks ago by kme
template - The Go Programming Language
A variable's scope extends to the "end" action of the control structure ("if", "with", or "range") in which it is declared, or to the end of the template if there is no such control structure. A template invocation does not inherit variables from the point of its invocation.
hugo  go  templates  documentation  webdevel  variables  scope 
10 weeks ago by kme
vuetify - love & hate
"Backward compatibility is a property of a system, product, or technology that allows for interoperability with an older legacy system, or with input designed for such a system"
Perl values backward compatibility a lot.
We expect a sane script or application that was written 10 year ago to just run on a current system.
vuetify .. not so much
webdesign  webdevel  vue  vuejs  materialdesign  perl  slides 
november 2019 by kme
« earlier      
per page:    204080120160

Copy this bookmark:

to read