Skip to content

Instantly share code, notes, and snippets.

View anshuraj's full-sized avatar
🎯
Focusing

Anshu Raj anshuraj

🎯
Focusing
View GitHub Profile
@anshuraj
anshuraj / OpenWithSublimeText2.bat
Created January 29, 2016 13:55 — forked from mrchief/LICENSE.md
Add "Open with Sublime Text 2" to Windows Explorer Context Menu (including folders)
@echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@anshuraj
anshuraj / OpenWithSublimeText3.bat
Created September 1, 2016 15:59 — forked from roundand/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@anshuraj
anshuraj / note-web
Last active April 11, 2018 06:35
nginx conf
server {
listen 80;
#listen 443 ssl;
root /path/to/project/;
server_name servername.com;
#ssl_certificate /etc/nginx/ssl/nginx.crt;
#ssl_certificate_key /etc/nginx/ssl/nginx.key;
- Assuming php is already installed in the system, open a terminal and run php -i. Copy the output.
- Goto https://xdebug.org/wizard.php and paste the phpinfo output in the text box.
- Follow the instructions.
@anshuraj
anshuraj / gist:fb287057636eee0edcc41e257e84dffd
Created April 11, 2018 06:33
Disable nginx startup on boot
sudo update-rc.d -f nginx disable
@anshuraj
anshuraj / search.js
Last active October 26, 2018 09:15
Javascript search in a list of string
search = (list, searchQuery) => {
var updatedList = list;
updatedList = updatedList.filter(function (item) {
return item.toLowerCase().search(
searchQuery.toLowerCase()) !== -1;
});
return updatedList;
}
@anshuraj
anshuraj / two_digits.js
Created May 1, 2018 06:11
input field restrict to 2 digits after decimal
$('.decimal').keypress(function (e) {
var character = String.fromCharCode(e.keyCode)
var newValue = this.value + character;
if(newValue.toString().split('.')[1].length > 2) {
e.preventDefault();
return false;
}
});
@anshuraj
anshuraj / rename.py
Last active May 1, 2018 06:17
Script to rename uppercase first letter of all the files in a directory
import os
for filename in os.listdir("."):
os.rename(filename, filename[0].upper() + filename[1:])
@anshuraj
anshuraj / index.html
Last active June 5, 2018 07:28
Center image
<html>
<head>
<title>center image</title>
<link href="style.css">
</head>
<body>
<div class=frame>
<span class="helper"></span><img src="http://via.placeholder.com/300x150" />
</div>
<div class=frame>
@anshuraj
anshuraj / center-div.css
Created June 5, 2018 09:45
Center a div
.centered-div{
width: auto;
position: relative;
transform: translate(-50%, 0);
left: 50%;
}