Skip to content

Instantly share code, notes, and snippets.

View sunitparekh's full-sized avatar

Sunit Parekh sunitparekh

View GitHub Profile
@sunitparekh
sunitparekh / null-values.json
Last active April 2, 2018 17:09
JSON sample representing different responses for NULL and EMPTY values
// Response with null and empty values -- NOT RECOMMENDED, JUST FOR REPRESENTATION PURPOSE --
{
"employeeId": 12345,
"firstName": "Sunit",
"lastName": "Parekh",
"mobile": null,
"addresses": []
}
Status: 200
Total-Count: 100
Next-Page: true
Content-Type: application/json
[
{
"employeeId":123456,
"firstName": "Sunit",
"lastName": "Parekh",
Status: 404
Content-Type: application/json
{
"code": "NOT_FOUND",
"message": "Oops! Requested employee 123456 not found."
}
Status: 400
@sunitparekh
sunitparekh / employee.json
Last active April 2, 2018 17:24
JSON Success response
Status: 200
Content-Type: application/json
{
"employeeId":123456,
"firstName": "Sunit",
"lastName": "Parekh",
"gender": "Male",
"hireDate": "2012-01-01",
"birthDate": "1990-01-01",
@sunitparekh
sunitparekh / TestMail.java
Last active October 4, 2015 09:27
Sample Email Test using Dumbster
import com.dumbster.smtp.SimpleSmtpServer;
import com.dumbster.smtp.SmtpMessage;
import org.junit.Test;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
public class TestEmail {
@Test
@sunitparekh
sunitparekh / git-pull-with-rebase-multi-repository-shell-script
Created September 3, 2015 04:38
Shell script to pull latest code from remote git repository for multiple projects
#!/bin/bash
repos=(
"/c/projects/project-1"
"/c/projects/project-2"
"/c/projects/project-3"
)
echo ""
echo "Getting latest for" ${#repos[@]} "repositories using pull --rebase"
@sunitparekh
sunitparekh / git-status-multi-repository-shell-scirpt
Last active September 3, 2015 04:39
Shell script to check satus of git repository for multiple projects
#!/bin/bash
repos=(
"/c/projects/project-1"
"/c/projects/project-2"
"/c/projects/project-3"
)
echo ""
echo "Checking" ${#repos[@]} "repositories for status"
@sunitparekh
sunitparekh / google_analytics.html
Last active August 29, 2015 14:00
Google Analytics tracking code
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-12345678-1', 'example.com');
ga('send', 'pageview');
</script>
@sunitparekh
sunitparekh / embed_gist.html
Created April 25, 2014 10:33
How to embed Gist in soupCMS markdown?
<script src="https://gist.github.com/sunitparekh/11284813.js"></script>
@sunitparekh
sunitparekh / embed_youtube.html
Last active August 29, 2015 14:00
How to add YouTube video to soupCMS markdown?
<iframe
id="ytplayer" type="text/html"
width="768" height="432"
src="//www.youtube.com/embed/U8GBXvdmHT4?html5=1"
frameborder="0" allowfullscreen autohide="1" rel="0"
/>