Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block jmoz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jmoz /
Created Sep 27, 2019
RSI calculation to match Tradingview
import pandas as pd
def rsi(ohlc: pd.DataFrame, period: int = 14) -> pd.Series:
"""See source
and fix
Relative Strength Index (RSI) is a momentum oscillator that measures the speed and change of price movements.
RSI oscillates between zero and 100. Traditionally, and according to Wilder, RSI is considered overbought when above 70 and oversold when below 30.
Signals can also be generated by looking for divergences, failure swings and centerline crossovers.
jmoz /
Created Aug 1, 2013
Twitter API favouriter
from twitter import Twitter, OAuth, TwitterHTTPError
jmoz /
Created Jul 25, 2013
Git initial config setup
git config --global "James Morris"
git config --global ""
git config --global core.editor vim
git config --global color.ui true
jmoz / phpunit_chaining.php
Last active Jan 19, 2016
Phpunit mocking and chaining.
View phpunit_chaining.php
namespace Foo\Unit;
class Foo
public function foo($foo = true)
return $foo;

OEmbed Liquid Tag for Jekyll

This is a simple liquid tag that helps to easily embed images, videos or slides from OEmbed enabled providers. It uses Magnus Holm's great oembed gem which connects to the OEmbed endpoint of the link's provider and retrieves the HTML code to embed the content properly (i.e. an in-place YouTube player, Image tag for Flickr, in-place slideshare viewer etc.). By default it supports the following OEmbed providers (but can fallback to or OoEmbed for other providers):

  • Youtube
  • Flickr
  • Viddler
  • Qik
  • Revision3
  • Hulu
  • Vimeo
jmoz / python_import_this
Created Apr 7, 2013
Python import this
View python_import_this
$ python
Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
jmoz /
Last active Dec 14, 2015
An example of client code and XML response from LinkedIn's network_updates endpoint. The access tokens used have requested the rw_nus permission.
from linkedin import linkedin
import config
li = linkedin.LinkedIn(config.Linkedin.API_KEY, config.Linkedin.API_SECRET, '')
"""the network_updates endpoint needs rw_nus permission, so do something like this during oauth flow:
li.request_token(['rw_nus', 'r_fullprofile'])
jmoz / ratchet_redis.php
Created Jan 22, 2013
Ratchet and Predis-async. (React and Redis).
View ratchet_redis.php
use RatchetApp\Pusher;
require __DIR__ . '/../vendor/autoload.php';
$loop = React\EventLoop\Factory::create();
$pusher = new Pusher();
$loop->addPeriodicTimer(10, array($pusher, 'timedCallback'));
jmoz / jquery_infinite_scroll.js
Last active Dec 11, 2015
jQuery infinite scroll.
View jquery_infinite_scroll.js
<script type="text/javascript">
$('body > .container').infinitescroll({
navSelector : "div.pagination",
nextSelector : "div.pagination a:last",
itemSelector : "div.item",
bufferPx: 1000,
jmoz / twitter_pagination.html
Created Jan 18, 2013
Twitter bootstrap HTML with Pagination object.
View twitter_pagination.html
<div class="pagination pagination-right">
<li{% if not pagination.prev_page %} class="disabled"{% endif %}><a {% if pagination.prev_page %}href="{{ url_for('index', page=pagination.prev_page) }}"{% endif %}>Prev</a></li>
{% for page in pagination.pages %}
{% set url_paged = url_for('index', page=page) %}
{% set url_not_paged = url_for('index') %}
<li {% if page == pagination.current_page %}class="active"{% endif %}><a {% if page != pagination.current_page %}href="{% if page == 1 %}{{ url_not_paged }}{% else %}{{ url_paged }}{% endif %}"{% endif %}>{{ page }}</a></li>
{% endfor %}
<li {% if not pagination.next_page %}class="disabled"{% endif %}><a {% if pagination.next_page %}href="{{ url_for('index', page=pagination.next_page) }}"{% endif %}>Next</a></li>
You can’t perform that action at this time.