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

View File

@@ -3,7 +3,7 @@
"slug": "cool-project", "slug": "cool-project",
"name": "Cool project 1", "name": "Cool project 1",
"image": "placeholder.jpg", "image": "placeholder.jpg",
"url": "#", "url": "https://www.google.com",
"date": "Jan 2014", "date": "Jan 2014",
"tags": ["Angular JS","API"] "tags": ["Angular JS","API"]
}, },
@@ -12,20 +12,31 @@
"image": "placeholder.jpg", "image": "placeholder.jpg",
"url": "#", "url": "#",
"date": "May 2014", "date": "May 2014",
"tags": ["Android","PHP"] "tags": ["Python","Django"]
}, },
{ {
"name": "Cool project 3", "name": "Cool project 3",
"image": "placeholder.jpg", "image": "placeholder.jpg",
"url": "#", "url": "#",
"date": "June 2014", "date": "June 2014",
"tags": ["HTML","JQuery","PHP"] "tags": ["HTML","JQuery","Django"]
}, },
{ {
"name": "Cool project 4", "name": "Cool project 4",
"image": "placeholder.jpg", "image": "placeholder.jpg",
"date": "Oct 2016", "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"> <div class="share-page">
Share this on &rarr; <span style="float: left;">Share this on &rarr;&nbsp;&nbsp;</span>
<!-- Twitter -->
<a href="https://twitter.com/share" class="twitter-share-button" data-via="{{ site.share.twitter_username }}">Tweet</a> <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> <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>
<!-- Google + --> <!-- Google + -->
<div class="g-plus" data-action="share" data-annotation="bubble"></div> <div class="g-plus" data-action="share" data-annotation="bubble"></div>
<script src="https://apis.google.com/js/platform.js" async defer></script> <script src="https://apis.google.com/js/platform.js" async defer></script>
<!-- Facebook --> <!-- 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 class="fb-share-button" data-href="{{ site.url }}{{ page.url }}" data-layout="button_count" style="position: relative; top: -8px; left: 3px;"></div>
</div> </div>
<div id="fb-root"></div> <div id="fb-root"></div>
<script>(function(d, s, id) { <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"> <link rel="stylesheet" href="/static/css/main.css">
<!-- Google Analytics --> <!-- 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> </head>
<body> <body>
@@ -105,7 +113,13 @@
</div> </div>
{% endif %} {% 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"> <div class="search" id="js-search">
<input type="text" placeholder="(sitemap)~$ type to search" class="search__input form-control" id="js-search__input"> <input type="text" placeholder="(sitemap)~$ type to search" class="search__input form-control" id="js-search__input">
@@ -114,9 +128,9 @@
<hr /> <hr />
<strong>Navigation</strong><br /> <strong>Navigation</strong><br />
&raquo; <a href="/">Home</a> <br /> &nbsp;&raquo; <a href="/">Home</a> <br />
{% for i in site.urls %} {% 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 %} {% endfor %}
</div> </div>

View File

@@ -33,14 +33,14 @@ layout: default
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if p_url == nil %}{% assign p_url = i.url %}{% endif %} {% 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> <h3 class="project-headlines">{{ i.name }}</h3>
{% if p_url %} </a> {% endif %} {% if p_url %} </a> {% endif %}
<div class="project-content"> <div class="project-content">
<div class="tag-holder"> <div class="tag-holder">
{% if i.tags %} {% if i.tags %}
{% for j in 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 %} {% endfor %}
{% endif %} {% endif %}
</div> </div>
@@ -48,7 +48,7 @@ layout: default
</div> </div>
<div class="project-footer"> <div class="project-footer">
{% if i.url %} {% 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 %} {% endif %}
<span class="project-timeline">{{ i.date }}</span> <span class="project-timeline">{{ i.date }}</span>
</div> </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 --> <!-- Pagination links -->
{% if paginator.total_pages > 1 %} {% if paginator.total_pages > 1 %}
<ul class="pagination"> <ul class="pagination pagination-sm">
{% if paginator.previous_page %} {% if paginator.previous_page %}
<li> <li>
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">&laquo;</a> <a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">&laquo;</a>

View File

@@ -4,4 +4,4 @@ title: Projects
permalink: /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 { .social li a {
font-size: 16px; 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 Elements
* ////////////////////////////////// */
*/
.project-outer { .project-outer {
display: inline-block; display: inline-block;
width: 30%; width: 30%;
@@ -15,7 +13,6 @@
h3.project-headlines { h3.project-headlines {
margin: 5px 0; margin: 5px 0;
font-size: 20px; font-size: 20px;
border-bottom: 1px #EEE solid;
} }
span.tags { span.tags {
font-size: 10px; font-size: 10px;
@@ -34,6 +31,7 @@ span.tags:last-child{ margin-right: 0; }
display: inline-block; display: inline-block;
position: relative; position: relative;
float: left; float: left;
text-decoration: none;
} }
.project-footer .project-timeline { .project-footer .project-timeline {
display: inline-block; display: inline-block;
@@ -69,3 +67,6 @@ span.tag-cloud {
background: #ccc; background: #ccc;
} }
.project-item.not-show{ display: none; } .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;} *{padding: 0; margin: 0;}
*/
/* ----------------------------------------------------------------------------------------------------------------*/ /* ---- thickbox specific link and font settings ---- */
/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
/* ----------------------------------------------------------------------------------------------------------------*/
#TB_window { #TB_window {
font: 12px Arial, Helvetica, sans-serif; font: 12px Arial, Helvetica, sans-serif;
color: #333333; color: #333333;
@@ -22,9 +20,7 @@
#TB_window a:active {color: #666666;} #TB_window a:active {color: #666666;}
#TB_window a:focus{color: #666666;} #TB_window a:focus{color: #666666;}
/* ----------------------------------------------------------------------------------------------------------------*/ /* ---- thickbox settings ---- */
/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
/* ----------------------------------------------------------------------------------------------------------------*/
#TB_overlay { #TB_overlay {
position: fixed; position: fixed;
z-index:100; z-index:100;
@@ -80,9 +76,9 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d
} }
#TB_closeWindow{ #TB_closeWindow{
height:25px; height: 35px;
padding:11px 25px 10px 0; padding: 10px 15px 10px 0;
float:right; float: right;
} }
#TB_closeAjaxWindow{ #TB_closeAjaxWindow{

File diff suppressed because one or more lines are too long