Skip to content

Instantly share code, notes, and snippets.

View ArupSen's full-sized avatar
🏠
Working from home

Arup Sen ArupSen

🏠
Working from home
View GitHub Profile
@ArupSen
ArupSen / rollDice.js
Created May 19, 2018 16:54
Basic js function to roll a pair of dice
function rollDice(){
var output = [];
var die1 = Math.floor(Math.random() * 6);
var die2 = Math.floor(Math.random() * 6);
// need to add 1 to avoid zero based output
output.push(die1 + 1);
output.push(die2 + 1);
return output;
}
<?php
/* ---------------------------------
26 January, 2008 - 2:55pm:
<!-- http://websitetips.com/articles/optimization/html/crunch/ -->
Adapted for WebsiteTips.com by Shirley Kaiser, SKDesigns skdesigns.com.
The example below is adapted from a post by londrum 8:29 pm on June 7, 2007:
<!-- http://www.webmasterworld.com/php/3361456.htm -->
"crunch up your HTML into a single line
a handy little script..."
@ArupSen
ArupSen / html.snippets
Created January 16, 2017 19:45
html snippets for snipmate.vim plugin
# Some useful Unicode entities
# Non-Breaking Space
snippet nbs
&nbsp;
# ←
snippet left
&#x2190;
# →
snippet right
&#x2192;
@ArupSen
ArupSen / codeeval_starter.rb
Created April 15, 2015 18:06
Basic starter file for solving Code Eval puzzles in ruby
# problem description here
#
File.open(ARGV[0]).each_line do |line|
# solution here
end
@ArupSen
ArupSen / touch-to-phone.html
Last active August 29, 2015 14:06
Trigger the device phone on touch event. Google Chrome workaround
<a href='tel:123456789' title='Free Call 123456789' class='tel'>Free Call 123 456 789</a><!-- works on most mobiles -->
<a href='tel://123456789' title='Free Call 123456789' class='tel'>Free Call 123 456 789</a><!-- workaround for chrome mobile -->
<a href='tel:123456789' title='Free Call 123456789' class='tel'>Free Call 123 456 789</a>
@ArupSen
ArupSen / workout
Created July 12, 2014 07:48
My workout which takes me about 15 minutes 3 times a week
-- Round 1 --
Pull ups with parallel hands - 8 reps followed by 10 reps on stool
Triceps dips - 20 reps
Plank with alternating knee forwards - 30 reps
-- Round 2 --
Chin ups with palms facing - 5 reps followed by 10 reps on stool
Triceps dips - 20 reps
Plank with alternating knee forwards - 30 reps
@ArupSen
ArupSen / rsync_backup
Last active August 29, 2015 14:03
rsync back up to local drive
# --delete anything not on source
# --progress show progress
# -h human readable
rsync -hva --delete --progress /Users/arup/Documents/ /Volumes/SL\ Backup/Users/arup/Documents/
@ArupSen
ArupSen / recallDefault.js
Created April 2, 2014 18:20
Add default text to form field. Text removed when field is focused but repopulated if nothing is entered and it loses focus.
function recall(thisfield, defaulttext) {
if (thisfield.value == "") {
thisfield.value = defaulttext;
}
}
// the following goes in the text input line
// onfocus="this.value= '';" onblur="recall(this,'Your email address');"
// change 'Your email address' to any default text
#!/usr/bin/env bash
# push to the yoga-clothes-company folder
rsync -e "ssh -p 2222" -havC --delete-excluded --exclude '.git/' --exclude yoga-clothes-company.sh --progress ~/GitRepos/yoga-clothes-company/ [email protected]:/home/arupsen/public_html/yoga-clothes-company/