A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.
One-line version to paste in your DevTools
Use $$
if your browser aliases it:
~ 108 byte version
Goal: a consistent style throughout all Elm projects that is easy to read and produces clean diffs to make debugging easier. This means valuing regularity and simplicity over cleverness.
Keep it under 80 characters. Going over is not the end of the world, but consider refactoring before you decide a line really must be longer.
#!/usr/bin/env bash | |
# names of latest versions of each package | |
export VERSION_PCRE=pcre-8.38 | |
export VERSION_OPENSSL=openssl-1.0.2d | |
export VERSION_NGINX=nginx-1.9.7 | |
# URLs to the source directories | |
export SOURCE_OPENSSL=https://www.openssl.org/source/ | |
export SOURCE_PCRE=ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ |
## app/controllers/application_controller.rb | |
class ApplicationController < ActionController::Base | |
@@silenced_actions = [:home] | |
def home | |
end | |
end |
var path = require('path'); | |
var _invalidateRequireCacheForFile = function(filePath){ | |
delete require.cache[path.resolve(filePath)]; | |
}; | |
var requireNoCache = function(filePath){ | |
_invalidateRequireCacheForFile(filePath); | |
return require(filePath); | |
}; |
Here's a nice trick for wrapping a method's implementation in a block, for example for logging the return value.
Have you ever written a method with a load of conditionals and return statements...
- (int)statusCode {
if (foo) {
return 1;
}
if (bar) {
<?xml version="1.0"?> | |
<config> | |
<modules> | |
<Davidf_AddCustomerGroupColumns> | |
<active>true</active> | |
<codePool>local</codePool> | |
</Davidf_AddCustomerGroupColumns> | |
</modules> | |
</config> |
/* | |
----------------------------------------------------------------------------- | |
"THE BEER-WARE LICENSE" (Revision 42): | |
<[email protected]> wrote this file. As long as you retain this notice you | |
can do whatever you want with this stuff. If we meet some day, and you think | |
this stuff is worth it, you can buy me a beer in return. -Michaël Sokol | |
----------------------------------------------------------------------------- | |
*/ |
<?php | |
function slugify($string, $toLower = true) { | |
$rules = "Any-Latin; Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove;"; | |
if ($toLower) { | |
$rules .= ' Lower();'; | |
} | |
$string = transliterator_transliterate($rules, $string); | |
// Remove repeating hyphens and spaces (e.g. 'foo---bar' becomes 'foo-bar') |