Skip to content

Instantly share code, notes, and snippets.

View piyushchauhan2011's full-sized avatar
🔥
Working

Piyush Chauhan piyushchauhan2011

🔥
Working
View GitHub Profile
@piyushchauhan2011
piyushchauhan2011 / highlight-text.html
Created September 12, 2016 05:40
Highlight Text event handle in UI
<input type='text' id='input' />
In software, a stack overflow occurs when too much memory is used on the call stack. The call stack contains a limited amount of memory, often determined at the start of the program. The size of the call stack depends on many factors, including the programming language, machine architecture, multi-threading, and amount of available memory. When too much memory is used on the call stack the stack is said to overflow, typically resulting in a program crash.[1] This class of software bug is usually caused by one of two types of programming errors.[2]
@piyushchauhan2011
piyushchauhan2011 / scalding_alice.scala
Created August 7, 2016 02:11 — forked from johnynek/scalding_alice.scala
Learn Scalding with Alice
/**
git clone https://github.com/twitter/scalding.git
cd scalding
./sbt scalding-repl/console
*/
import scala.io.Source
val alice = Source.fromURL("http://www.gutenberg.org/files/11/11.txt").getLines
// Add the line numbers, which we might want later
val aliceLineNum = alice.zipWithIndex.toList
@piyushchauhan2011
piyushchauhan2011 / grunt-hugo-lunrjs.md
Created June 23, 2016 15:59 — forked from sebz/grunt-hugo-lunrjs.md
hugo + gruntjs + lunrjs = <3 search
@piyushchauhan2011
piyushchauhan2011 / BFS.kt
Created June 21, 2016 23:28
Breadth first search in Kotlin
import java.util.*
/**
Graph
9 7
0 1
1 2
1 3
2 3
3 4
@piyushchauhan2011
piyushchauhan2011 / DFS-Connected-Components.kt
Created June 21, 2016 23:12
Connected components and Depth first search implemented in Kotlin
/**
Graph
9 7
0 1
1 2
1 3
2 3
3 4
6 7
6 8
@piyushchauhan2011
piyushchauhan2011 / Bank-Account.txt
Last active September 4, 2023 17:28
Program related to managing a bank account in Kotlin language
"100001", "Howard, J", "Saving", 2.5, 5000
"100002", "Brown, C", "Cheque", 2.5, 6400
"100003", "Smith, W", "Saving", 1.5, 400
"100004", "Frank, N", "Saving", 2.5, 1000
"100005", "Munch, R", "Cheque", 2.75, 6200
"100006", "Sidney, M", "Saving", 3.5, 12800
"100007", "Gao, F", "Saving", 2.0, 5000
"100008", "Long, P", "Cheque", 3.0, 7300
def find_string(text, word)
(0..text.size-word.size).each do |i|
{ i, text[i..i+word.size-1] }
if text[i..i+word.size-1] == word
return i
end
end
nil
end
@piyushchauhan2011
piyushchauhan2011 / gist:ff2ab7ded0447723bdd922682c624ead
Created June 8, 2016 08:11 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@piyushchauhan2011
piyushchauhan2011 / boot.rb
Created May 8, 2016 06:29 — forked from johnknott/boot.rb
Replacing "irb" with "pry" when using "padrino console"
# Add this to your boot.rb before Padrino.load!
# and add: gem 'pry'
# to your Gemfile and run bundle to install.
begin
require 'pry'
$VERBOSE = nil
IRB = Pry
$VERBOSE = false
rescue LoadError
// A Unit test template for Tape
// See 5 Questions every unit test must answer:
// https://medium.com/javascript-scene/what-every-unit-test-needs-f6cd34d9836d
import test from 'tape';
test('What are you testing?', assert => {
const msg = 'what should it do?'
const actual = 'what was the output?';