Skip to content

Instantly share code, notes, and snippets.

Avatar
🎶

Saurabh tkshnwesper

🎶
View GitHub Profile
@tkshnwesper
tkshnwesper / loading-spin.svg
Last active Aug 29, 2015
Loading spin (SVG)
View loading-spin.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tkshnwesper
tkshnwesper / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View Incrementer.php
function getIncrement($str) {
$len = strlen($str);
if($str === '') {
return '0';
}
for($i = $len - 1; $i >= 0; $i--) {
if($str[$i] === '9') {
$str[$i] = 'A';
break;
}
View ll.java
LinkedList<String> list = new LinkedList<>();
View add.java
list.add("Hello");
list.add("world");
list.add("my");
list.add("name");
list.add("is");
list.add("saurabh");
for(String s : list) {
System.out.println(s);
}
View push.java
list.push("Hello");
list.push("world");
list.push("my");
list.push("name");
list.push("is");
list.push("saurabh");
for(String s : list) {
System.out.println(s);
}
View pop.java
while(!list.isEmpty()) {
String el = list.pop();
System.out.println(el);
}
/*
Hello
world
my
name
View pollFirst.java
while(!list.isEmpty()) {
String el = list.pollFirst();
System.out.println(el);
}
/*
Hello
world
my
name
View pollLast.java
while(!list.isEmpty()) {
String el = list.pollLast();
System.out.println(el);
}
/*
saurabh
is
name
my
@tkshnwesper
tkshnwesper / strshuffle.go
Last active Sep 21, 2016
String Shuffle in Go
View strshuffle.go
// StrShuffle shuffles a string that is passed to it
func StrShuffle(str string) string {
n := 25 + rand.Intn(25)
var runes []rune
for _, runeval := range str {
runes = append(runes, runeval)
}
var shuffle = func() bool {
if rand.Intn(2) == 1 {
return true
You can’t perform that action at this time.