Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

Ovilia Ovilia

View GitHub Profile
@Ovilia
Ovilia / SleepBot.js
Last active Dec 26, 2015
Analysize Sleeping Records from SleepBot
View SleepBot.js
var fs = require('fs');
// SleepBot.csv is downloaded from https://mysleepbot.com
var lines = fs.readFileSync('SleepBot.csv').toString().split('\n');
var sumToSleep = 0;
var sumToAwake = 0;
var sumSleepMin = 0;
@Ovilia
Ovilia / sortings
Created Jun 10, 2015
Sorting Algorithms
View sortings
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
//#define PRINT_RESULT
// insert sort: n * n
template <typename T>
void insertSort(int len, T* arr)
@Ovilia
Ovilia / 2014-08-04-replace-last-filter-for-jekyll-liquid-01.html
Created Aug 4, 2014
2014-08-04-replace-last-filter-for-jekyll-liquid-01
View 2014-08-04-replace-last-filter-for-jekyll-liquid-01.html
<a class="button view-source" href="https://raw.githubusercontent.com/Ovilia/blog/gh-pages/_posts/{{ page.url | append: '@' | replace: '/', '-' | remove_first: '-' | remove: '-@' }}.md" target="_blank">View Source on GitHub</a>
@Ovilia
Ovilia / 2014-08-03-make-your-own-social-sharing-bar-with-jekyll-04.html
Created Aug 3, 2014
2014-08-03-make-your-own-social-sharing-bar-with-jekyll-04
View 2014-08-03-make-your-own-social-sharing-bar-with-jekyll-04.html
<a href="https://twitter.com/intent/tweet?text={{ page.title }}&url={{ page.url }}&via=OviliaZhang"></a>
@Ovilia
Ovilia / 2014-08-03-make-your-own-social-sharing-bar-with-jekyll-03.html
Last active Aug 29, 2015
2014-08-03-make-your-own-social-sharing-bar-with-jekyll-03
View 2014-08-03-make-your-own-social-sharing-bar-with-jekyll-03.html
{% assign tagStr = '' %}
{% capture url %}{{ site.url }}{{ page.url }}{% endcapture %}
{% if page.shortUrl != null %}
{% assign url = page.shortUrl %}
{% for tag in page.tags %}
{% capture tagStr %}{{ tagStr }},{{ tag }}{% endcapture %}
{% endfor %}
{% endif %}
<hr />
<h4>Share This Post</h4>
@Ovilia
Ovilia / 2014-08-03-make-your-own-social-sharing-bar-with-jekyll-02
Created Aug 3, 2014
2014-08-03-make-your-own-social-sharing-bar-with-jekyll-02
View 2014-08-03-make-your-own-social-sharing-bar-with-jekyll-02
{% capture url %}{{ site.url }}{{ page.url }}{% endcapture %}
{% if page.shortUrl != null %}
{% assign url = page.shortUrl %}
{% endif %}
@Ovilia
Ovilia / 2014-08-03-make-your-own-social-sharing-bar-with-jekyll-01
Created Aug 3, 2014
2014-08-03-make-your-own-social-sharing-bar-with-jekyll-01
View 2014-08-03-make-your-own-social-sharing-bar-with-jekyll-01
{% assign tagStr = '' %}
{% for tag in page.tags %}
{% capture tagStr %}{{ tagStr }},{{ tag }}{% endcapture %}
{% endfor %}
View 2014-07-15-jekyll-related-posts-without-plugin
View 2014-05-18-jekyll-tag-searching
{% capture tags %}
{% for tag in site.tags %}
{{ tag[0] }}
{% endfor %}
{% endcapture %}
{% assign sortedtags = tags | split:' ' | sort %}
{% for tag in sortedtags %}
<div id="tag-{{ tag }}" class="tag-posts">
{% for post in site.posts %}
@Ovilia
Ovilia / 001.grammer.the.good.parts.01.js
Created Feb 14, 2013
JavaScript escape related string
View 001.grammer.the.good.parts.01.js
// In JavaScript string, you don't need to escape /
var a = "a/b"; // will give "a/b"
// But if you use \, it can be escaped
var b = "a\/b"; // will also give "a/b"
// While \ should always be escaped
var c = "a\b"; // will give "a" since \b means a backspace,
// which does nothing special here
You can’t perform that action at this time.