How to change the color of the dropdown that appears with ctrl + shift + p in VSCode - themes

I was trying to edit some themes on my Vscode but got stuck at this point since I don't know what this section is referred as, that we pop up by ctrl + shift + p
"workbench.colorCustomizations": {
"editor.background": "#101a29",
"sideBar.foreground": "#CAC9C9",
"sideBarSectionHeader.foreground": "#CAC9C9",
"editorGroupHeader.tabsBorder": "#c93e71",
"editor.selectionBackground": "#ff6d6d32",
"editor.wordHighlightBackground": "#ff6d6d32"
},
I've did these many changes so far.

Primarily that is the quickInput so
"quickInput.background": "#f00"
will work. If you don't style the quickInput then the more generic editorWidget will also work but will also style other things, like the Find Widget.
"editorWidget.foreground": "#000",
"editorWidget.background": "#a8c0a8",

Related

How to allocate the label center of case using sphinx?

I'm writing equations using sphinx. My code looks like this:
.. math::
:label: eq1
\begin{eqnarray}
\begin{cases}
a_{11}x_{1} + \dots + a_{1m}x_{m} = b_1\\
a_{21}x_{1} + \dots + a_{2m}x_{m} = b_2
\end{cases}
\end{eqnarray}
This displays the label (1) on the right side of the first line, but I would to allocate it the center of this {cases}, namely, between the first and the second line.
How do I do this?
This question seems to pertain principally about MathJax usage.
By some experimenting I discovered it understands \smash and that using it provides the hoped for label placement. But perhaps there is some MathJax setting which would avoid using this \smash. Besides \smash works fine only for two or three "cases".
I have moved the \smash approach to second part, where also its drawbacks are explained. Indeed, I have since found a half-satisfying CSS approach.
At any rate, don't use eqnarray there.
CSS based approach
Create a file _static/custom.css in your source repertory with these contents.
.MathJax_Display {
transform: translate(0%,-50%) translate(0%,8px);
}
div.math {
transform: translate(0%,50%);
}
Add this at end of conf.py:
if html_theme != 'alabaster':
def setup(app):
app.add_stylesheet('custom.css')
For example I obtain this with 'classic' theme:
This works also with 'agogo' and 'alabaster' themes, but some fine tuning might be needed for equations with only one line to be positioned like the label.
In the case RTD theme it does not work at all.
Support may be browser dependent.
\smash approach
Text before.
.. math::
:label: eq1
\smash{\begin{cases}
a_{11}x_{1} + \dots + a_{1m}x_{m} &= b_1\\
a_{21}x_{1} + \dots + a_{2m}x_{m} &= b_2
\end{cases}}
Text after.
I get from make html (with classic theme)
conf.py contains
extensions = ['sphinx.ext.mathjax',
]
html_theme = 'classic'
By the way your eqnarray is not good mark-up. IF you use it you should use :nowrap: option. See Sphinx doc.
Note Of course usage of cases here is dubious because your example is one of equations. I added &'s but the spacing is one appropriate for cases, which is surely not the one expected. So remove them.
Here is mark-up which does not abuse cases environment:
Text before.
.. math::
:label: eq1
\smash{\left\{\begin{aligned}
a_{11}x_{1} + \dots + a_{1m}x_{m} &= b_1\\
a_{21}x_{1} + \dots + a_{2m}x_{m} &= b_2
\end{aligned}\right.}
Text after.
CAVEAT The smash trick only works with two (perhaps three) equations, even in MathJax.

Switch scrolling direction with shortkey

I currently have an AHK script which switches the scrolling direction of my mouse.
WheelUp::
Send {WheelDown}
Return
WheelDown::
Send {WheelUp}
Return
My colleagues don't like this and use my computer sometimes.
How can I assign a shortkey to switch the scrolling direction?
What I want:
When I press win+z the scrolling direction is changed, when I pres win+z again, the scrolling direction is changed back.
So basically the scrolling direction can be changed when pressing win+z
Is that possible with AHK?
Yes you can modify your hotkeys to have more code.
You will have to use if statements and variables.
Example:
global direction := 1
^s:: ; ctrl + s will launch this code you can modify this to win + z
direction := Mod( direction + 1 , 2 ) ; alternates values of direction between 1 and 0
return
WheelUp::
if(direction)
Send {WheelDown}
else
Send {WheelUp}
Return
; and reverse for wheeldown

Comment Opening and Closing Brackets (with ReSharper?)

Does anyone know if there's a way in Visual Studio 2010 with ReSharper 6.1 to comment out the selected lines of code with their closing brackets - or simply to comment out both the highlighted opening bracket and it's corresponding closing bracket? Here's an example of what I mean:
if(something) {
do(this);
}
I am looking for a hot-key so that when if(something) { is selected, it will comment out if(something) { and }, preferably fixing the tabs once commented like so:
// if(something) {
do(this);
//}
This isn't entirely what you're after, but it's pretty close:
Highlight the code inside the if statement by placing the cursor at one brace and hitting Ctrl + Shift + ].
Now hit Ctrl + Shift + Alt + Left Arrow. This will move the code 'left', i.e. outside of the if statement.
You don't need to comment the if statement out after this because it's empty.
Note that you can also move code 'right' to put it back in the if statement later.

Jquery FullCalendar event timeslot hover method

I have FullCalendar up and running and it is very nice. My question here is how best to go about implementing timeslot hover functionality. It would be very nice if the user could have a visual cue for any given timeslot they are hovering over.
I found the following link http://code.google.com/p/fullcalendar/issues/detail?id=269 that gives a solution that adds a new structure in agenda cell row in order to provide access to individual cells. However, it is indicated that this solution will cause FullCalendar to become sluggish.
Before I start looking into the FullCalendar code, I thought I would ask if anyone else has any ideas or a solution.
My thoughts about approaching this are as follows:
Add placeholder events to each timeslot. The user would not see these events but these invisible events could be used to allow "hover" marking. My concern here is that adding the extra events would cause FullCalander to become sluggish. Also, the drag and drop functionality could be impacted.
FullCalender can determine what timeslot the user clicked in. Would it be possible to use the code that gets the timeslot clicked on in order to provide a reference for hover highlighting?
Other?
I am considering option 2 as a place to start. However, if anyone has another idea for a workable solution, I would be glad to hear it.
If I come up with a solution, I will post it here.
Thanks,
Jim
Here is a link to the FullCalendar site: http://fullcalendar.io/
I have found it very nice to work with.
The following code did the trick for me.
$('.ui-widget-content').hover(function(){
if(!$(this).html()){
for(i=0;i<7;i++){
$(this).append('<td class="temp_cell" style="border: 0px; width:'+(Number($('.fc-day').width())+2)+'px"></td>');
}
$(this).children('td').each(function(){
$(this).hover(function(){
$(this).css({'background-color': '#ffef8f', 'cursor': 'pointer'});
},function(){
$(this).prop('style').removeProperty( 'background-color' );
});
});
}
},function(){
$(this).children('.temp_cell').remove();
});
Make sure to add it after the code that instantiates the calendar and, it should work AS IS if the defaultView property of the JQuery calendar is 'AgendaWeekly'.
Cheers,
M
I had the same problem since it's sometimes hard to see which timeslot you're actually clicking on. To fix this I wrote a line to alter fullcalendar.js. Not the ideal solution, but it's a quick fix.
This is the line:
"<input type='hidden' class='timeslot-value' value='" + formatDate(d, opt('axisFormat')) +"'>" +
And placed it inside (around code line 3080):
"<th class='fc-agenda-axis " + headerClass + "'>" +
((!slotNormal || !minutes) ? formatDate(d, opt('axisFormat')) : ' ') +
"</th>" +
"<td class='" + contentClass + "'>" +
"<input type='hidden' class='timeslot-value' value='" + formatDate(d, opt('axisFormat')) +"'>" +
"<div style='position:relative'> </div>" +
"</td>" +
Now you can just place a tooltip hover on all fc-slots that have the .ui-widget-content class (the <td> you see above in the code). And get the hidden input value to display in that tooltip.
If jQuery, you can use the live event and get the corresponding first child and grab its value.
If extJS
Ext.onReady(function(){
Ext.QuickTips.init();
var tip = Ext.create('Ext.tip.ToolTip', {
target: 'your-calendar-id',
width: 140,
minHeight: 30,
delegate: '.ui-widget-content',
autoHide: false,
renderTo: Ext.getBody(),
listeners: {
beforeshow: function updateTipBody(tip) {
tip.update('<dl><dt style="font-weight: 600;"><?php echo $this->translate('Start time')?>: </dt><dd>' + Ext.get(this.triggerElement).first().getValue() + '</dd></dl>');
}
}
});
});
I realize this isn't actually an answer but a comment on a previous answer but I've yet to reach the reputation to comment on answers.
W.R.T to the answer by #user4243287 one extra step I had to take was to put this logic in the 'viewRender' option when initializing my calendar in order to make sure that this continued to work when moving between weeks.

AutoHotKey For Loop

I am trying to get a script like this in AHK but I don't know how to write it in AHK:
string arrow
if (leftArrowKeyPressed) {
arrow = "left"
}
if (rightArrowKeyPressed) {
arrow = "right"
}
if (arrow = "left") {
for (int number = 1000; number < 10000; number++) {
simulateKeyPresses(number)
simulateKeyPresses(mousebutton0)
}
}
I did something similar to this. It uses the While command. Your code might look something like the following:
~left::
While GetKeyState("left", "P") {
Send {NUMBER}
Send {MOUSE_BUTTON}
}
Line 1: '~left::' tells the following lines of code to activate when the left button is pressed. The '~' tells the program to still allow the 'left' arrow key to work. If you wanted this code to run and simultaneously block the 'left' arrow from working, remove the '~'.
Line 2: 'While GetKeyState("left", "P")' is self-explanatory. It's a 'while' loop that runs as long as you are holding the 'left' arrow key.
Line 3 and line 4 are for your code to go. Note that 'NUMBER' can be replace by any number 0-9, and 'MOUSE_BUTTON' can be replaced by either the left mouse button (LButton) or the right mouse button (RButton).
I hoped this helped get you started. Also, as formentioned, the AHK Help manual is very informative. You can search 'AutoHotKey Help' on your computer for your off-line version, or visit this link for the online version. These manuals include documentation of just about anything you could ever hope for, as well as a useful example of code at the bottom of each page.

Resources