Skip to content

Instantly share code, notes, and snippets.

View mr-karan's full-sized avatar
🎯
Focusing

Karan Sharma mr-karan

🎯
Focusing
View GitHub Profile
import datetime
current =datetime.datetime.today().year #Current year
userchoice=1
name=input("Enter your name")
while(userchoice==1):
age=int(input("Enter your age"))
hundredthYear=current+(100-age)
print ("You will turn 100 in" + str(hundredthYear))
@mr-karan
mr-karan / gist:9eca91f2ff29842087b9
Created February 4, 2015 06:18
commits.io - poster
from math import *
class Complex(object):
def __init__(self,real,imag):
self.r=float(real)
self.i=float(imag)
def add(self,first,second):
c.r=first.r+second.r
c.i=first.i+second.i
@mr-karan
mr-karan / README.md
Last active August 29, 2015 14:15 — forked from hofmannsven/README.md

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@mr-karan
mr-karan / hello101
Created June 27, 2015 12:36
iPython Scraping
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
@mr-karan
mr-karan / mean.js starter
Last active August 29, 2015 14:24
getting up with mean.js
$ npm install -g bower
$ npm install -g grunt-cli
$ npm install -g yo
$ npm install -g generator-meanjs
$ yo meanjs
$ grunt
Other generators for Angular , Express here : http://meanjs.org/generator.html
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects#Defining_getters_and_setters
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get
var log = ['test'];
var obj = {
get latest () {
if (log.length == 0) return undefined;
return log[log.length - 1]
}
}
console.log (obj.latest); // Will return "test".
@mr-karan
mr-karan / guide
Created July 5, 2015 18:01
MEGA Guide to steps in building a MEAN stack App
express project
bootstrap ui
fix angular routes and add templates
$routeprovider
$locationprovider
create templates(views for all routes)
add a service api.js
$resource
database schemas
events
@mr-karan
mr-karan / BecomeADev.py
Last active September 3, 2015 06:44
script to install essentials after a fresh OS install
#color schemes
'''
Terminal
- [ ] fish , oh my fish
- [ ] tmux
- [ ] color scheme
Text Editors
- [ ] atom
- [ ] sublime text
@mr-karan
mr-karan / javaSyntax.java
Last active July 11, 2024 16:20
Java Syntax cheatsheet
import java.util.Scanner;
import java.util.ArrayList;
public class hello {
public static void main(String[] args) throws Exception
{
Scanner reader = new Scanner(System.in);