Skip to content

Instantly share code, notes, and snippets.

View sarkarshuvojit's full-sized avatar
🌀

Shuvojit Sarkar sarkarshuvojit

🌀
View GitHub Profile
@sarkarshuvojit
sarkarshuvojit / back_arrow_vector.xml
Created February 24, 2017 06:00
Google is very confused about what it wants to name the back button of the action bar, and keeps changing it version-by-version. This is an exact copy of the back button vector, add it in drawables/ to use.
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:autoMirrored="true"
android:tint="?attr/colorControlNormal">
<path
android:pathData="M20,11L7.8,11l5.6,-5.6L12,4l-8,8l8,8l1.4,-1.4L7.8,13L20,13L20,11z"
android:fillColor="@android:color/white"/>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /mnt/Bostu/Workspaces/amarRootFolder/
ServerAlias hostname.localhost
ServerName hostname.localhost
<Directory /mnt/Bostu/Workspaces/amarRootFolderI>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
@sarkarshuvojit
sarkarshuvojit / alarm
Created March 30, 2017 19:51
This is a bash script to set volume to ~100% and play any song. Generally to be used as a cron job as alarm.
# Author: sarkarshuvojit
# set this as a cron job for your specific time to set volume to ~100% and play any song at specific times
# set display and set volume to ~100%
export DISPLAY=:0 && amixer -D pulse sset Master 64000
# kill all previous tabs so that no other song is disrupting your hardcore alarm
killall chrome
# open google chrome with the youtube url
google-chrome-stable "https://www.youtube.com/watch?v=fJ9rUzIMcZQ" # kickass song
@sarkarshuvojit
sarkarshuvojit / .my.cnf
Last active April 24, 2017 09:36
Cron job to backup the database everynight.
[mysqldump]
user=root
password=somepass
@sarkarshuvojit
sarkarshuvojit / a2ensite
Created April 9, 2017 15:57
a2ensite for manjaro/arch
#!/bin/bash
if test -d /etc/httpd/conf/sites-available && test -d /etc/httpd/conf/sites-enabled ; then
echo "-------------------------------"
else
mkdir /etc/httpd/conf/sites-available
mkdir /etc/httpd/conf/sites-enabled
fi
avail=/etc/httpd/conf/sites-available/$1.conf
enabled=/etc/httpd/conf/sites-enabled
site=`ls /etc/httpd/conf/sites-available/`
@sarkarshuvojit
sarkarshuvojit / a2dissite
Created April 9, 2017 15:59
a2dissite for manjaro/arch
#!/bin/bash
avail=/etc/httpd/conf/sites-enabled/$1.conf
enabled=/etc/httpd/conf/sites-enabled
site=`ls /etc/httpd/conf/sites-enabled`
if [ "$#" != "1" ]; then
echo "Use script: n2dissite virtual_site"
echo -e "\nAvailable virtual hosts: \n$site"
exit 0
else
if test -e $avail; then
@sarkarshuvojit
sarkarshuvojit / regex
Created April 10, 2017 09:52
Regex to search for all codeigniter-style urls containing base_url and convert them to laravel-style urls
search : \<\?php echo base_url\(\)\; \?\>(.*\.js)
replace: {{ URL::assets(\'$1\') }}
search : \<\?php echo base_url\(\)\; \?\>(.*\.css)
replace: {{ URL::assets(\'$1\') }}
@sarkarshuvojit
sarkarshuvojit / form.html
Last active December 4, 2017 23:58
Art of Laziness — Form Validation HTML
...
<div class="form-group">
<input type="text" class="form-control form-validate" placeholder="Your First Name" data-error-message="Please enter your name">
</div>
<div class="form-group">
<input type="text" class="form-control form-validate" placeholder="Your Last Name" data-error-message="Please enter your surname">
</div>
...
...
<div class="form-group">
@sarkarshuvojit
sarkarshuvojit / validate.js
Last active December 5, 2017 00:18
Art of Laziness — Form Validation JS
$(document).ready(function(){
// invoke function when form is submit
$("#form-name").submit(function(e){
// select all the input fields with form-validate class and loop over them
$(".form-validate").each(function () {
// check if the the form is empty/filled with spaces
if($(this).val().trim().length == 0){
// get the respective data-validation-error
var errorMessage = $(this).attr('data-validation-error');
// show the error message somehow
@sarkarshuvojit
sarkarshuvojit / index.php
Last active December 6, 2017 20:33
Structure Core PHP Sample Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My Website</title>
</head>