Skip to content

Instantly share code, notes, and snippets.

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

Ankur Bansal krazylearner

🏠
Working from home
View GitHub Profile
@krazylearner
krazylearner / Python_List_list()_Method
Created June 12, 2015 14:41
Python List list() Method
The method list() takes sequence types and converts them to lists. This is used to convert a given tuple into list.
aTuple = (123, 'xyz', 'zara', 'abc');
aList = list(aTuple)
print "List elements : ", aList
#When we run above program, it produces following result:
#As your program gets longer, you may want to split it into several files for easier maintenance.
#You may also want to use a handy function that you’ve written in several programs without copying its definition into each program.
#To support this, Python has a way to put definitions in a file and use them in a script or in an interactive instance of the interpreter.
#Such a file is called a module; definitions from a module can be imported into other modules or into the main module
# Fibonacci numbers module
# fibo.py
def fib(n): # write Fibonacci series up to n
a, b = 0, 1
while b < n:
@krazylearner
krazylearner / dir()_in_python
Created June 17, 2015 11:38
he built-in function dir() is used to find out which names a module defines. It returns a sorted list of strings:
>>> import sys
>>> dir(sys)
['__displayhook__', '__doc__', '__excepthook__', '__name__', '__package__',
'__stderr__', '__stdin__', '__stdout__', '_clear_type_cache',
'_current_frames', '_getframe', '_mercurial', 'api_version', 'argv',
'builtin_module_names', 'byteorder', 'call_tracing', 'callstats',
'copyright', 'displayhook', 'dont_write_bytecode', 'exc_clear', 'exc_info',
'exc_traceback', 'exc_type', 'exc_value', 'excepthook', 'exec_prefix',
'executable', 'exit', 'flags', 'float_info', 'float_repr_style',
@krazylearner
krazylearner / start_jenkins
Created June 21, 2015 08:39
Script to start jenkins from windows command line
net stop jenkins
java -Dhudson.util.ProcessTree.disable=true -jar "C:\Program Files (x86)\Jenkins\jenkins.war" --httpPort=8080
@krazylearner
krazylearner / adb.md
Last active August 29, 2015 14:23
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client-server program that includes three components:

Android Debug Bridge (adb) is a command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client-server program that includes three components:


A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device. A daemon, which runs as a background process on each emulator or device instance. You can find the adb tool in /platform-tools/.

When you start an adb client, the client first checks whether there is an adb server process already running.

@krazylearner
krazylearner / setup_jdb.md
Last active September 16, 2025 12:32
set up jdb with android

start bluestack or emulator install app on it start the app

connect adb to emulator

$ adb connect localhost:5555

get 'pid' of your app .Dont forget to run it first in emulator

@krazylearner
krazylearner / styles.md
Last active August 29, 2015 14:23
styles views layouts User interface PART 1

PART 1

  1. Styles and themes are time-saving ways to create a consistent look and feel across your Android application.
  2. Styles and themes are essentially the same thing: a collection of properties.
  3. These properties can be anything from button color to the "wrap content" attribute or the size of your text.
  4. The crucial difference is how they’re applied to your project:
  5. A style is applied to a View.
  6. A theme is applied to individual activities or an entire application.

Why Should I Use Themes and Styles?

@krazylearner
krazylearner / Semantic_Versioning.md
Last active August 29, 2015 14:24
Semantic Versioning 2.0.0

Summary

Given a version number MAJOR.MINOR.PATCH, increment the:

  1. MAJOR version when you make incompatible API changes,
  2. MINOR version when you add functionality in a backwards-compatible manner, and
  3. PATCH version when you make backwards-compatible bug fixes.

##Semantic Versioning Specification (SemVer)

@krazylearner
krazylearner / design_1.md
Last active October 3, 2015 11:49
nodejs design patterns applicable for other programming languages

##Patterns for writing functions ###how do you deliver errors to the code that called your function ?

''' Document what your function does, including what arguments it takes (including their types and any other constraints), what it returns, what errors can happen, and what those errors mean. So if you're writing a new function, you have to tell your callers what errors can happen and what they mean. '''

three basic patterns for a function to deliver errors.

Throw, Callback, or EventEmitter
@krazylearner
krazylearner / function_check.md
Created October 3, 2015 12:26
An example Consider a function that asynchronously connects to a TCP port at an IPv4 address. Here's an example of how we might document it:
/*
 * Make a TCP connection to the given IPv4 address.  Arguments:
 *
 *    ip4addr        a string representing a valid IPv4 address
 *
 *    tcpPort        a positive integer representing a valid TCP port
 *
 *    timeout        a positive integer denoting the number of milliseconds