How to put 2 element on each other - html-email

I have 2 hr tags in an email body and I want to place them on top of each other.
This is what I have tried:
<div>
<div><hr color="gray" width="500" align="left"></div>
<div><hr color="teal" width="250" align="left" margin="-15px"> </div>
</div>
I have tried several different tags and until now I can see both hr tags one above/before the other.

Simply add position absolute to your divs.
div{
position: absolute;
}

In the absence of other responses, I would suggest a table structure (since in emails you would already be using tables), and then a simple border-bottom or border-top, to achieve this.
If you want 15px of teal on the left, and the rest gray:
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="15" style="border-bottom:1px solid teal">
</td>
<td style="border-bottom:1px solid grey">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</td>
</tr>
</table>

Related

vim diff view for long lines

Is there a solution for getting a useful vim diff with very long lines? The problem I have is that for example I have one long line in one file:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
In another file I have a line very similar, but I have two changes. I capitalize ipsum to IPSUM and Duis to DUIS.
Lorem IPSUM dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. DUIS aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
The problem is that now, when I compare these two files with :diffthis, vimdiff highlights everything between IPSUM and DUIS, and this is really useless to look at. I would like to just see highlighted LOREM and DUIS and their lowercase counterparts. Here is an image of what my vimdiff view looks like. Is there a way to achieve this?
The behaviour I want is actually the default diff view in pycharm. This image is from pycharm:
I found a plugin that does what I am asking for:
https://github.com/rickhowe/diffchar.vim

In flutter development, how to print long string in visual studio code debug console?

I want to print large string in flutter but they are truncated.
Example, this is 1342 characters string:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum
dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad'); // minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.
Only the top 1022 characters will be printed.
I try to use debugPrint and print functions but nothing.
What I can do?
That's due to VS Code truncating big strings, usually bigger than 1000 char of being printed at once.
You can try a little "hack" by splitting it into words and print each of it.
myLongString.split(' ').forEach((word) => print(" " + word));
You can also try to use the logging package, but probably it will experience the same problem when trying to print the whole string, since it is trying to stdout all at once.
you can use log(message) function.

How can I stop MailApp.sendEmail() from adding line breaks to an email body every ~80 chars?

I am using a google script attached to a google sheet in my Google Drive to send emails. I have noticed that MailApp.sendEmail() sends emails with a body that have doesn't quite look like the original: it adds a line break every ~75 characters (without interrupting words).
How can I stop the MailApp.sendEmail() function from doing this?
Here's an example to illustrate:
Running this function :
function sendTestEmail(){
var text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
MailApp.sendEmail("test#gmail.com", "test", text);
}
Will give an email that looks like this
In case it's useful, I tested a bit: a 76 character sentence stays on one line (no more), but adding an extra word made the last two words of this new sentence go to a new line.
Thanks a lot in advance !
EDIT 1: These line breaks do not appear in mac mail or thunderbird, but do appear on the iphone gmail app.
Also I tried using html instead of plain text, and it does remove the unwanted line breaks: great! But it also removes all line breaks unless I put <br> manually.
I might need to fine tune details, but as suggested the following works for me. The text.replace is needed to make the line breaks I might put in intentionally to appear in the html email.
function sendTestEmail(){
var text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
var htmlText = text.replace(/\n/g,'\n<br>');
MailApp.sendEmail({
to: "test#gmail.com",
subject: "test",
htmlBody: htmlText,
});

Parse multipart/form-data cakephp 3

I'm currently trying to parse the multipart/form-data that I send through Postman plugin in Chrome. However, I get the following output:
'------WebKitFormBoundarymsXhoqlRBbTbsZFb
Content-Disposition: form-data; name="album_id"
2
------WebKitFormBoundarymsXhoqlRBbTbsZFb
Content-Disposition: form-data; name="description"
haiahaahahahdaisdhisadhisadihsdhiiahsd
------WebKitFormBoundarymsXhoqlRBbTbsZFb
Content-Disposition: form-data; name="favorite"
true
------WebKitFormBoundarymsXhoqlRBbTbsZFb
Content-Disposition: form-data; name="uploadfile"; filename="test2.txt"
Content-Type: text/plain
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
------WebKitFormBoundarymsXhoqlRBbTbsZFb
Content-Disposition: form-data; name="uploadfile"; filename="test.txt"
Content-Type: text/plain
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
------WebKitFormBoundarymsXhoqlRBbTbsZFb--
'
This output do I get when I try to debug $this->request->input(). When I try $this->request->input('json_decode') I get an empty array, so I'm assuming that the data isn't in a proper format (just a string). Before I write my own algorithm I want to be sure that I'm not reinventing the wheel with this one. I'm doing something wrong? Or if not, does there exist some Cakephp 3 function which takes care of this?
Update
I found what is wrong in my code and it seems like the routing process somehow empties the post array to early. When I try Postman with the following endpoint http://vecto.app/api/pictures $this->request->data is empty. However, when I try to access the endpoint http://vecto.app/pictures the $this->request->data is filled with the information. Does anyone know what is wrong with the following routing setup:
Router::prefix('api', function ($routes) {
$routes->extensions(['json', 'xml']);
$routes->resources('Users');
$routes->resources('Pictures');
// We connect the /register action so we can simply extend the CRUD Plugin add() method
// and benefit of already available logic like validation and response codes instead of having to reinvent the wheel.
Router::connect('/api/users/register', ['controller' => 'Users', 'action' => 'add', 'prefix' => 'api']);
$routes->fallbacks('InflectedRoute');
});
I finally found the solution which was a beforeFilter that emptied the $this->request->data array. Therefore, the input array wasn't empty but the data array was empty. This is the code that caused the problem:
public function beforeFilter(Event $event) {
if ($this->request->is('post')) {
$data = $this->request;
$this->request->data = $this->request->input(function ($data) {
return json_decode($data, true);
});
}
}

Loading Flash object in Facebook tab causes inline text to change in Safari

If you create a new app in Facebook pointing to an HTML page with only the code below, you will see an obvious change in font-smoothing in the paragraph after the Flash object loads. This only occurs in WebKit browsers and only in Facebook.
<!doctype html>
<head></head>
<body style="background-color: #333">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100%" height="170" id="movie_name" align="middle">
<param name="movie" value="http://edmullen.net/flash/BBC1.swf"/>
<param name="wMode" value="transparent" />
<object type="application/x-shockwave-flash" data="http://edmullen.net/flash/BBC1.swf" width="100%" height="170">
<param name="movie" value="http://edmullen.net/flash/BBC1.swf"/>
<param name="wMode" value="transparent" />
</object>
</object>
<p style="color: red">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p style="color: white">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</body>
</html>
I've replicated this with multiple swf files. I even went so far as to embed the Flash object in an iframe, but the bug persists.
There is an old bug on the webkit site explaining this behavior. Basically, the loading of the object causes a repaint event, and on the second pass the font renderer does not return the same result as the first. Here is the reference:
Font antialiasing (smoothing) changes when elements are rendered into compositing layers