The Shapes of CSS
Examples how to create dozens of shapes using pure CSS and a single HTML element.
King of Nothing, the DCI paradigm is a scam
I’ve worked on huge applications in Ruby and Rails before. I very much want to believe in DCI, but I’m having a hard time accepting the promises of Clean Ruby when it seems like the work on this paradigm is half-done. If it weren’t so oversold and hyped, I think I’d be more patient, but right now I’m just frustrated and confused.
Git blame: How to ignore white-space modifications
When doing a git blame
, git will blame the person who added or removed white space in a line (e.g. by indenting), not the person who originally wrote the code.
Say git blame -w
to ignore such white-space changes. You want this. \
Note that you can also use it when diffing: git diff -w
.
Example
Consider this method, created by a user in commit d47bf443
:
def hello
'world'
end
^
$ git blame foo
d47bf443 (Arne Hartherz 2012-12-19 14:44:38 +0100 1) def hello
d47bf443 (Arne Hartherz 2012-12-19 14:44:38 +0100 2...
Why your browser loses cookies when following hyperlinks from an Excel spreadsheet or Word document
Microsoft Office pre-fetches hyperlinks using an internal DLL (which doesn't know about your cookies), follows all redirects and opens your browser with the result. This is because of stupidity.
The "fix" is to not redirect but just render a text like "access denied" with 200 OK when you see that request.env['HTTP_USER_AGENT'].include?('ms-office')
.
randym/axlsx · GitHub
Axlsx is an incredible gem to generate "Office Open XML" spreadsheet files (XLSX). Does not break on large spreadsheets and supports a ton of features like graphs.
API looks mature and existing code is easy to migrate when coming from the spreadsheet
gem.
The documentation of some methods is a bit out of date, but you'll find your way around the gem's code.
No support for reading files, however. :( If you want to open XLSX spreadsheets (for example to confirm your output in tests), you can use [roo
](h...
Consul 0.4.2 improves querying of nil powers
Previous versions of Consul exhibited strange behavior when querying a power that returns nil
.
Consul 0.4.2+ behaves as expected:
power.notes # => returns nil
power.notes? # => returns false
power.notes! # => raises Consul::Powerless
power.note?(Note.last) # => returns false
power.note!(Note.last) # => raises Consul::Powerless
occ/TraceKit · GitHub
Tracekit is a JavaScript library that automatically normalizes and exposes stack traces for unhandled exceptions across the 5 major browsers: IE, Firefox, Chrome, Safari, and Opera.
Force GitHub Pull Requests to update the diff against its target branch
When you have a Pull Request on GitHub that includes commits from another Pull Request, you will still see them after the "child" PR has been merged. Unfortunately, GitHub won't automatically update the diff (or commit list).
Here is what worked for me:
- Check out the target branch
git checkout my-target-branch
- Make sure you are up to date against origin (e.g.
git fetch
andgit status
). You should be 0 commits ahead or behind.
- Add and commit a file
touch .please-update
git add .please-update
- `gi...
lorempixel - placeholder images for every case
Generate dummy images for a given dimension and topic.
Git: In an (interactive) rebase, find out which commit you are currently working on (until version < 1.7.9.5)
When you are using git rebase
and are currently editing a commit (due to a conflict, for example), you may want to know the current commit. [1]\
Luckily, there is lots of useful stuff in the .git
directory.
Commit hash that you are currently applying
cat .git/rebase-merge/stopped-sha
Useful if you want to inspect the original commit for its changes, for example like:
git show `cat .git/rebase-merge/stopped-sha`
Current commit's message
cat .git/rebase-merge/message
In case you forgot what the changes are suppo...
Twinkle: Mark window as "demands attention" or show a text notification on incoming call
Mark window as "demands attention"
Install wmctrl
through your package manager, i.e.
sudo apt-get install wmctrl
Download the attached script and mark it as executable.
Then go to Edit -> User Profile -> Scripts
and add the script for "call incoming".
Text notification
You can additionally get a notification bubble in your window manager, by adding
notify-send "Eingehender Anruf..."
to the script.
Responsive & Touch-Friendly Audio Player | Codrops
A jQuery audio player plugin that is responsive and touch-friendly. The UI is css-only, no images used.
jquery-timing - a jQuery plugin you should know about
jquery-timing is a very useful jquery plugin that helps to remove lots of nested anonymous functions. It's API provides you some methods that help you to write readable and understandable method chains. See yourself:
Example
// before
$('.some').show().children().doThat();
window.setTimeout(function(){
$('some').children().doSomething().hide(function() {
window.setTimeout(function() {
otherStuffToDo();
}, 1000);
});
}, 500);
// after
$('.some').s...
How to provoke Selenium focus issues in parallel test processes
As attachments to this card you will find a Cucumber feature and supplementing step definition that you can use to provoke Selenium focus issues that only occur when two focus-sensitive Selenium scenarios run at the same time (probably with parallel_tests). This can help you to detect and fix flickering integration tests.
The attached feature works by going to your root_path
and focusing a random form element every 5...
Simple memory information widget for the Xfce panel (or anywhere else where you can run a shell command)
I was unsatisfied with the existing memory status applets for the Xfce panel, so I wrote a little shell script that shows me just the information I need. Now I use it via a "Generic Monitor" panel applet.
Put this at some place like ~/bin/memory-info
and chmod +x
it:
#!/bin/sh
meminfo=`free -m | grep 'Mem:'`
used=`echo $meminfo | cut -d" " -f3`
total=`echo $meminfo | cut -d" " -f2`
cached=`echo $meminfo | cut -d" " -f7`
really_used=`expr $used - $cached`
echo "Memory usage: $really_used / $total (Cached: ...
Git: Twelve Curated Tips And Workflows From The Trenches
This article contains:
- Making ‘git diff’ wrap long lines
- Set a global proxy
- Clone only a specific branch
- Diff file against remote branch
- List all deleted files in the repository
- Search for a string in all revisions of entire git history
- Apply a patch from another (unrelated) local repository
- Making a more recent branch the new master
- Adding an initial empty commit to a branch to allow full rebase
- Zero a branch to do something radically different
-...
Analyse TCP/UDP traffic with netcat
Sometimes you want to see what data you get through a TCP or UDP connection.
For example, you want to know how a HTTP Request look like.
It's very easy with netcat.
Example to listen on port 80 and the output gets to stdout.
sudo nc -kl 80
It's also possible write it into a file:
sudo nc -kl 80 > output.txt
If you use Ports higher than 1000 you don't need to be root (sudo).
Git: Add all changes
A nice way to stage absolutely all changes (edits, additions, deletions):
git add --all
Custom bash autocompletion
The bash offers control over the behavior of autocompletion.
The most primitive example is this (just run it in your bash; if you want it available everywhere, put the complete ...
line into your .bashrc
):
> complete -W "list of all words for an automatic completion" command_to_be_completed
> command_to_be_completed a<TAB>
all an automatic
With complete
you define how the specified command shall be completed. For basic needs, -W
(as in "word list") should be enough, but you may also specify a function, a glob patte...
Performance analysis of MySQL's FULLTEXT indexes and LIKE queries for full text search
When searching for text in a MySQL table, you have two choices:
- The LIKE operator
- FULLTEXT indexes (which currently only work on MyISAM tables, but will one day work on InnoDB tables. The workaround right now is to extract your search text to a separate MyISAM table, so your main table can remain InnoDB.)
I always wondered how those two methods would scale as the number of records incr...
How to test if an element has scrollbars with JavaScript (Cucumber step inside)
The basic idea is pretty simple: an element's height is accessible via the offsetHeight
property, its drawn height via scrollHeight
-- if they are not the same, the browser shows scrollbars.
var hasScrollbars = element.scrollHeight != element.offsetHeight;
So, in order to say something like...
Then the element "#dialog_content" should not have scrollbars
... you can use this step (only for Selenium scenarios):
Then /^the element "([^\"]+)" should( not)? have scrollbars$/ do |selector, no_scrollbars|
scroll_heig...