Skip to content

Instantly share code, notes, and snippets.

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

Harsha Jujjavarapu sriharshaj

🏠
Working from home
View GitHub Profile
@sriharshaj
sriharshaj / react_form.js
Last active September 6, 2017 13:44
React form sample
const Card = (props) => {
return (
<div style={{margin: '1em'}}>
<img width='75' src={props.avatar_url} />
<div style={{display: 'inline-block', marginLeft: 10}}>
<div style={{fontWeight: 'bold', fontSize: '1.25em'}}>
{props.name}
</div>
<div>{props.company}</div>
</div>
@sriharshaj
sriharshaj / react_components.js
Last active September 6, 2017 07:06
React Basic Component Structure
class Button extends React.Component {
handleClick = () => {
this.props.onClickFunction(this.props.incrementValue);
}
render() {
return(
<button onClick={this.handleClick}>
+{this.props.incrementValue}
@sriharshaj
sriharshaj / symbol_iterator.js
Created September 5, 2017 06:43
Create custom iterator for objects
'use strict';
let idMaker = {
[Symbol.iterator](){
let nextId = 8000;
return {
next(){
return {
value: nextId++,
done: false
@sriharshaj
sriharshaj / mysql.database.yml
Created August 28, 2017 18:56 — forked from jwo/mysql.database.yml
Sample config/database.yml from Rails. Postgres, MySQL, and SQLite
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
@sriharshaj
sriharshaj / greeter.rb
Last active November 23, 2015 09:13
Require modules and inheriting modules class Boy
require './person.rb'
class Greeter < Person::Boy
PERSON_TYPE ="make it"
def initialize (name)
super(name)
end
def say_hi
puts "Hii #{@name}"
end
def say_bye
@sriharshaj
sriharshaj / gist:e4976c1cb93e0bc64d34
Last active August 29, 2015 14:27
Gem update on Ubuntu

Cos I always forget it...

  1. sudo gem install rubygems-update
  2. sudo update_rubygems
@sriharshaj
sriharshaj / aws.sns.js
Last active December 31, 2024 13:51
AWS SNS ( Simple Push Notification ) using Node.js
var AWS = require('aws-sdk');
AWS.config.update({accessKeyId: config.AWSAccessKeyId, secretAccessKey: config.AWSSecretKey,{region: config.AWSRegion}});
var sns = AWS.SNS();
var params ={
Name:"test",
Platform:"GCM",//or APNS (Apple ) or ADM (Amazon)
Attributes:{ // required
@sriharshaj
sriharshaj / populate.js
Last active January 16, 2019 18:41
Populate Plain JSON Objects in Mongoose
/*
Company Schema
{
name : String ,
founded:Number,
headquaters : {"type":ObjectId, ref:"City"}
}
City Schema
{