added new features

This commit is contained in:
agusmakmun
2016-06-11 03:16:04 +07:00
parent 2b3a8775d9
commit c93580f192
14 changed files with 146 additions and 65 deletions

View File

@@ -3,7 +3,7 @@ description: My Personal Stack Problems
author: Agus Makmun
github: https://github.com/agusmakmun
about: I am freelance developer. Currently doing more in backend, actually in Python and Django.
disqus_shortname: aboutashu
disqus_shortname: stackproblems
google_analytics: UA-XXXXXXXX-Y
enableTags: true
@@ -20,15 +20,15 @@ social:
- icon: fa-skype
link: "#"
- icon: fa-twitter
link: "#"
link: "https://twitter.com/agusmakmun6"
- icon: fa-linkedin
link: "#"
- icon: fa-stack-exchange
link: "#"
share:
twitter_username: 216ashutosh
fb_appid: 0000000000000
twitter_username: agusmakmun6
fb_appid: 1749788565247320
urls:
- text: About Me
@@ -42,8 +42,8 @@ urls:
url: "https://agusmakmun.github.io"
baseurl: ""
paginate: 20
per_page: 20
paginate: 15
per_page: 15
paginate_path: "/page:num/"
markdown: kramdown
gems:

View File

@@ -3,7 +3,7 @@
"slug": "cool-project",
"name": "Cool project 1",
"image": "placeholder.jpg",
"url": "#",
"url": "https://www.google.com",
"date": "Jan 2014",
"tags": ["Angular JS","API"]
},
@@ -12,20 +12,31 @@
"image": "placeholder.jpg",
"url": "#",
"date": "May 2014",
"tags": ["Android","PHP"]
"tags": ["Python","Django"]
},
{
"name": "Cool project 3",
"image": "placeholder.jpg",
"url": "#",
"date": "June 2014",
"tags": ["HTML","JQuery","PHP"]
"tags": ["HTML","JQuery","Django"]
},
{
"name": "Cool project 4",
"image": "placeholder.jpg",
"date": "Oct 2016",
"tags": ["Android","nodejs"]
"tags": ["Python","nodejs"]
},
{
"name": "Cool project 5",
"image": "placeholder.jpg",
"date": "Oct 2016",
"tags": ["Python","nodejs"]
},
{
"name": "Cool project 6",
"image": "placeholder.jpg",
"date": "Oct 2016",
"tags": ["Python","nodejs"]
}
]

View File

@@ -1,10 +0,0 @@
<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','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
</script>

View File

@@ -1,14 +1,16 @@
<div class="share-page">
Share this on &rarr;
<a href="https://twitter.com/share" class="twitter-share-button" data-via="{{ site.share.twitter_username }}">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<span style="float: left;">Share this on &rarr;&nbsp;&nbsp;</span>
<!-- Google + -->
<div class="g-plus" data-action="share" data-annotation="bubble"></div>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<!-- Twitter -->
<a href="https://twitter.com/share" class="twitter-share-button" data-via="{{ site.share.twitter_username }}">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<!-- Facebook -->
<div class="fb-share-button" data-href="{{site.url}}{{page.url}}" data-layout="button_count" style="position: relative; top: -8px; left: 3px;"></div>
<!-- Google + -->
<div class="g-plus" data-action="share" data-annotation="bubble"></div>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<!-- Facebook -->
<div class="fb-share-button" data-href="{{ site.url }}{{ page.url }}" data-layout="button_count" style="position: relative; top: -8px; left: 3px;"></div>
</div>
<div id="fb-root"></div>
<script>(function(d, s, id) {

View File

@@ -1,7 +0,0 @@
<div class="social">
<ul>
{% for link in site.social %}
<li><a href="{{ link.link }}" target="_blank"><i class="fa {{ link.icon }}"></i></a></li>
{% endfor %}
</ul>
</div>

View File

@@ -91,7 +91,15 @@
<link rel="stylesheet" href="/static/css/main.css">
<!-- Google Analytics -->
{% include analytics.html %}
<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','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
@@ -105,7 +113,13 @@
</div>
{% endif %}
{% include social_links.html %}
<div class="social">
<ul>
{% for link in site.social %}
<li><a href="{{ link.link }}" target="_blank"><i class="fa {{ link.icon }}"></i></a></li>
{% endfor %}
</ul>
</div>
<div class="search" id="js-search">
<input type="text" placeholder="(sitemap)~$ type to search" class="search__input form-control" id="js-search__input">
@@ -114,9 +128,9 @@
<hr />
<strong>Navigation</strong><br />
&raquo; <a href="/">Home</a> <br />
&nbsp;&raquo; <a href="/">Home</a> <br />
{% for i in site.urls %}
&raquo; <a class="about" href="{{ i.url }}">{{ i.text }}</a><br />
&nbsp;&raquo; <a class="about" href="{{ i.url }}">{{ i.text }}</a><br />
{% endfor %}
</div>

View File

@@ -33,14 +33,14 @@ layout: default
{% endif %}
{% endfor %}
{% if p_url == nil %}{% assign p_url = i.url %}{% endif %}
{% if p_url %}<a href="{{ p_url }}">{% endif %}
{% if p_url %}<a class="project-detail" href="{{ p_url }}">{% endif %}
<h3 class="project-headlines">{{ i.name }}</h3>
{% if p_url %} </a> {% endif %}
<div class="project-content">
<div class="tag-holder">
{% if i.tags %}
{% for j in i.tags %}
<span class="tags tag-filter" data-tag="{{ j | downcase }}"><a href="#">{{ j }}</a></span>
<span class="tags tag-filter" data-tag="{{ j | downcase }}"><a href="#{{ j }}">{{ j }}</a></span>
{% endfor %}
{% endif %}
</div>
@@ -48,7 +48,7 @@ layout: default
</div>
<div class="project-footer">
{% if i.url %}
<a href="{{ i.url }}" class="project-link">View</a>
<a href="{{ i.url }}" class="project-link" target="_blank"><i class="fa fa-globe"></i> View</a>
{% endif %}
<span class="project-timeline">{{ i.date }}</span>
</div>

68
_posts/2016-06-11-mdam.md Normal file
View File

@@ -0,0 +1,68 @@
---
layout: post
title: "Find Substrings for line Encoding [CF]"
date: 2016-06-11 03:04:23 +0700
categories: [python, codefights]
---
Given a string, return its encoding defined as follows:
First, the string is divided into the least possible number of disjoint **substrings** consisting of identical characters
for example, `"aabbbc"` is divided into `["aa", "bbb", "c"]`
Next, each substring with length greater than one is replaced with a concatenation of its length and the repeating character
for example, substring `"bbb"` is replaced by `"3b"`
Finally, all the new strings are concatenated together in the same order and a new string is returned.
####SUBSTRING
A **substring** of a string `S` is another string `S'` that occurs in `S`. For example, `"Fights"` is a substring of `"CodeFights"`, but `"CoFi"` isn't.
**Example**
For `s = "aabbbc"`, the output should be `lineEncoding(s) = "2a3bc"`.
**Input/Output**
* [time limit] 4000ms (py)
* [input] string s (String consisting of lowercase English letters.)
_Constraints:_ `4 ≤ s.length ≤ 15.`
* [output] string
Encoded version of s.
**Solution:**
```python
import re
def lineEncoding(s):
grub = [ m.group(0) for m in re.finditer(r"(\w)\1*", s )]
numb = 0
out = []
for i in grub:
numb += 1
if len(i) > 1:
out.append(grub[numb-1].replace(grub[numb-1], str(len(i))+i[0]))
else:
out.append(i)
return ''.join(out)
```
**Result Tests:**
```python
>>>
s = "aabbbc"
>>> lineEncoding(s)
"2a3bc"
>>>
>>> s = "abbcabb"
>>> lineEncoding(s)
"a2bca2b"
>>>
>>> s = "abcd"
>>> lineEncoding(s)
"abcd"
>>>
```

View File

@@ -13,7 +13,7 @@ layout: default
<!-- Pagination links -->
{% if paginator.total_pages > 1 %}
<ul class="pagination">
<ul class="pagination pagination-sm">
{% if paginator.previous_page %}
<li>
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">&laquo;</a>

View File

@@ -4,4 +4,4 @@ title: Projects
permalink: /projects/
---
Few of my projects. Currently doing more in Android, NodeJS.
Few of my projects. Currently doing more in backend, actually in Python and Django.

View File

@@ -210,3 +210,9 @@ div.col-sm-3 img#about {
.social li a {
font-size: 16px;
}
.share-page {
padding: 10px 10px 5px;
border-top: 1px solid #f0f0f0;
border-bottom: 1px solid #f0f0f0;
}

View File

@@ -1,8 +1,6 @@
/**
* //////////////////////////////////
/*
* Project Elements
* //////////////////////////////////
*/
*/
.project-outer {
display: inline-block;
width: 30%;
@@ -15,7 +13,6 @@
h3.project-headlines {
margin: 5px 0;
font-size: 20px;
border-bottom: 1px #EEE solid;
}
span.tags {
font-size: 10px;
@@ -34,6 +31,7 @@ span.tags:last-child{ margin-right: 0; }
display: inline-block;
position: relative;
float: left;
text-decoration: none;
}
.project-footer .project-timeline {
display: inline-block;
@@ -69,3 +67,6 @@ span.tag-cloud {
background: #ccc;
}
.project-item.not-show{ display: none; }
a.project-detail:hover {text-decoration: none;}
a.project-detail:hover h3 {color: #62A253;}

View File

@@ -1,11 +1,9 @@
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---- global settings needed for thickbox ---- */
/*
*{padding: 0; margin: 0;}
*/
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---- thickbox specific link and font settings ---- */
#TB_window {
font: 12px Arial, Helvetica, sans-serif;
color: #333333;
@@ -22,9 +20,7 @@
#TB_window a:active {color: #666666;}
#TB_window a:focus{color: #666666;}
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---- thickbox settings ---- */
#TB_overlay {
position: fixed;
z-index:100;
@@ -80,9 +76,9 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d
}
#TB_closeWindow{
height:25px;
padding:11px 25px 10px 0;
float:right;
height: 35px;
padding: 10px 15px 10px 0;
float: right;
}
#TB_closeAjaxWindow{

File diff suppressed because one or more lines are too long