Skip to content

Instantly share code, notes, and snippets.

View sayham-sjb's full-sized avatar
🌐
^-^

Sayham Chowdhury sayham-sjb

🌐
^-^
View GitHub Profile
@sayham-sjb
sayham-sjb / fibonacci.java
Last active January 25, 2018 18:15
fibonacci #java #VS
Private static int index = 0;
public static void main (String[] args){
int n1 = 0;
int n2 = 1;
System.out.println(“index: “ + index + “ = “ + n1);
fibonacci(n1, n2);
}
public static void fibonacci(int n1, int n2){
System.out.println(“index: “ + index + “ = “ + n2);
if (index == 20){ //Stopping point.
@sayham-sjb
sayham-sjb / JavaRecursionMethod_myRecursive1.java
Last active January 25, 2018 18:15
JavaRecursionMethod_myRecursive1 #java #VS
public int myRecursive(){
int myRecursive();
}
@sayham-sjb
sayham-sjb / JavaRecursionMethod_myRecursive2.java
Last active January 25, 2018 18:14
JavaRecursionMethod_myRecursive2 #java #VS
public int myRecursive (int jVariable){
System.out.println(jVariable);
jVariable--;
if(jVariable == 0) //Stopping Point
return 0;
return myRecursive(jVariable);
}
@sayham-sjb
sayham-sjb / HowToPrintContentsFromCertainDIV_printSpecificDiv1.js
Last active January 25, 2018 18:14
HowToPrintContentsFromCertainDIV_printSpecificDiv1 #js #VS
function printSpecificDiv(divId) {
var printContent = document.getElementById(divId);
var windowUrl = 'about:blank';
var windowName = 'Print' + new Date().getTime();
var printWindow = window.open(windowUrl, windowName,
'left = 10000, top = 10000, width = 0, height = 0');
printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
@sayham-sjb
sayham-sjb / HowToPrintContentsFromCertainDIV_printSpecificDiv2.js
Last active February 20, 2018 02:43
HowToPrintContentsFromCertainDIV_printSpecificDiv2 #js #VS
function printSpecificDiv(divID) {
var divElements = document.getElementById(divID).innerHTML;
var wholePage = document.body.innerHTML;
document.body.innerHTML = "<html><head><title></title></head><body>"
+ divElements + "</body>";
window.print();
document.body.innerHTML = wholePage;
return false;
}
@sayham-sjb
sayham-sjb / HowToPrintContentsFromCertainDIV_printThisDiv3.html
Last active January 25, 2018 16:33
HowToPrintContentsFromCertainDIV_printThisDiv3 #html #VS
<div id = "printThisDiv">
This part of the page will only be printed!!!
</div>
<input type = "button" value = "Print"
onclick = "JavaScript:printSpecificDiv('printThisDiv');" />
@sayham-sjb
sayham-sjb / ClickCountWithJavaScript1.js
Last active January 25, 2018 18:13
ClickCountWithJavaScript1 #js #VS
var count = 0;
var countButton = document.getElementById("countButton");
var displayCount = document.getElementById("displayCount");
countButton.onclick = function(){
count++;
displayCount.innerHTML = count;
}
resetButton.onclick = function(){
count = 0;
displayCount.innerHTML = count;
@sayham-sjb
sayham-sjb / ClickCountWithJavaScript_localStorage.js
Last active January 25, 2018 18:13
ClickCountWithJavaScript_localStorage #js #VS
$("#countButton").on('click', function(e) {
if (typeof(Storage) !== "undefined") {
if (localStorage.clickcount) {
localStorage.clickcount = parseInt($("#displayCount").text());
localStorage.clickcount = Number(localStorage.clickcount) + 1;
} else {
localStorage.clickcount = 0;
}
document.getElementById("displayCount").innerHTML = localStorage.clickcount;
} else {
@sayham-sjb
sayham-sjb / ClickCountWithHovering.html
Last active January 25, 2018 18:13
ClickCountWithHovering #html #VS
<html>
<head>
<script>
var hoverCount = 1;
</script>
</head>
<body>
<div style="text-align: center;">
<button class="hoverButton" type='button'
onmouseover='alert ("Hovered " + hoverCount +" times.");
@sayham-sjb
sayham-sjb / TwitterCrammingUser.js
Last active January 25, 2018 18:12
TwitterCrammingUser #js #VS
// ==UserScript==
// @name Twitter Cramming
// @description Force enable cramming (280 character tweets) on Twitter
// @author Prof. 9
// @version 0.1
// @match https://twitter.com/*
// @run-at document-idle
// @namespace prof9.twittercramming
// ==/UserScript==