Fabric is really amazing / preferable to bash scripting.
Here’s my script to pull remote data into my local environment
Yuji's Increasingly Infrequent Ramblings
Fabric is really amazing / preferable to bash scripting.
Here’s my script to pull remote data into my local environment
If you’re wondering where your header went, consider if it contains underscores.
Nginx needs the underscores_in_headers setting on to handle underscores in header names correctly. No need to set manual proxy header forwarding, just set this flag:
underscores_in_headers on;
Here’s a method I just used to add some very / arbitrarily complex validation logic to your existing jQuery Validation form.
The use case was that my form, depending on arbitrary third party ajax calls, could contain custom invalid fields in ways that would be difficult to carry out through the framework itself.
Why not offload all of that logic to some third party, like the server, and then have some javascript simply set data attributes on the form elements which mark it as "invalid"?
That’s exactly what I did.
For example, my server could claim that the ship_state field is invalid for various reasons. All my AJAX needed to do was set a data attribute on that field called `custom-validator-exception`, with the value as the error message, and the validation framework seamlessly incorporates that error into the workflow.
https://gist.github.com/yuchant/955414c26733adfc1e25
Awesome!
Sometimes, you need to manually trigger the lazyload even though you want it to respond to scroll events normally.
Simply trigger the `appear` event to force lazyload to load the image.
This is applicable in my case when for example I am using lazyload on a gallery slider where the user may scroll down to it, or use a button to trigger the new slides to appear.
Example:
$("img.lazy").trigger(‘appear’);
The answer was in the source. Always look in the source.
This is not an easy question to ask: I am talking about ordering list A by the order of matching values found in list B.
Most results talk about ordering list A by an ordering field in list B.
After some thinking, it became really obvious how to do this.
Simply create an empty list, find the index of an item in list A of list B.
list_a = [100, 1, 10] list_b = [1, 10, 100] sorted_list_b_by_list_a = sorted(list_a, key=lambda x: list_a.index(x))
Having auto-fill select widgets is a night and day improvement in UX for large select boxes.
Adding it to django suit was easy, but surprisingly not documented.
It has been easy to add Chosen or Select widgets via the popular django integration packages, but it failed to work on inlines.
To make that as easy as possible, I just decided to manually convert all select widgets on the screen into select2 widgets via a form include.
It was quite simple to hook into Suit’s add-inline event listener and remove the old select classes and adding new ones.
It should be a breeze to localize this if you are having it applied to random pieces.
This is extremely useful if you need to preserve height flow, but need to stack elements for the all too common use case of cross fading between elements.
Simply apply relative positioning, float the element, -100% margin left, and left of 100%. Apply clearfix to your parent, and now you have stacked elements that are still contribute to vertical flow.
Amazing.
.configuration-image-wrapper {
@include clearfix;
img {
position: relative;
top: 0;
left: 100%;
margin-left: -100%;
float: left;
}
}
Linode.com has always been great. Support. Always at the cutting edge.
Imagine my surprise when I’m checking out the processor on my VPS because I randomly saw it’s a dual core… which is unusual.
Then, I look it up on a benchmark site (because you can’t judge CPUs by clock speed or model numbers).
This CPU is the third fastest one in the world right now and costs nearly $2k.
http://www.cpubenchmark.net/cpu.php?cpu=Intel+Xeon+E5-2680+v2+%40+2.80GHz&id=2061
Absolutely crazy. I would never expect to get one so fast…
Here’s my Linode affiliate link.
https://www.linode.com/?r=964d9fe684204460dd42f36002f33ad337460423
Simple: add to your bashrc file
force_color_prompt=yes
I’ve never even heard of a colorless monitor anyways..
HTML newsletters are a *huge* pain, but mostly due to all of the inline CSS that’s hard to manage. Your code becomes a mess. Every task is like finding needles in a haystack.
Instead… just use normal CSS and use tools to inline the CSS for you, like this one by MailChimp: