Skip to content

Instantly share code, notes, and snippets.

View singh1114's full-sized avatar

Ranvir Singh singh1114

View GitHub Profile
package io.singh1114.springboottut.school;
import javax.persistence.*;
@Entity
public class School {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="id")
package io.singh1114.springboottut.school;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@RestController
public class SchoolController {
@singh1114
singh1114 / post.html
Last active October 30, 2019 18:15
Basic jekyll post.html file.
---
layout: default
---
<article class="post">
<h1>{{ page.title }}</h1>
<div class="date">
Written on {{ page.date | date: "%B %e, %Y" }}
</div>
@singh1114
singh1114 / post.html
Last active October 30, 2019 18:21
Jekyll post content for adding some code after regular instances.
...
<div class="entry">
{% include share-bar.html %}
{% assign content_para = content | split: "<p>" %}
{% for para in content_para %}
{{para}}
{% assign para_number = forloop.index | modulo: 10 %}
{% if para_number == 0 %}
<h2>Your SPECIAL CODE</h2>
{% endif %}
package io.singh1114.springboottut;
import io.singh1114.springboottut.school.School;
import io.singh1114.springboottut.school.SchoolRepository;
import org.json.JSONException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
spring.datasource.url=jdbc:mysql://localhost:3306/springtestguide
spring.datasource.username=root
spring.datasource.password=<password>
spring.jpa.hibernate.ddl-auto=update
package io.singh1114.springboottut;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.PropertySource;
@Configuration
@ComponentScan("io.singh1114.springboottut")
@Profile("test")
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<div id="share-bar">
<h4>Share this:</h4>
<div class="share-buttons">
<a href="https://www.facebook.com/sharer/sharer.php?u={{ site.url }}{{ site.baseurl }}{{ page.url }}"
onclick="window.open(this.href, 'pop-up', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"
title="Share on Facebook" >
<i class="fa fa-facebook-official share-button"> facebook</i>
<div class="linked_post">
{% for post in site.posts %}
{% assign post_url = post.url | replace: "/", "" %}
{% if post_url == include.url %}
<div class="linked_post_div">
<article class="post">
<h1><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></h1>
<p style="color: #969494; margin: 10px 0px; font-size: 18px;">
{{ post.date | date: "%B %e, %Y" }}
</p>
{% include linked_post.html url="how-to-contribute-to-open-source-and-land-a-better-job" %}