Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@clody69
clody69 / download_funds.Rmd
Last active January 3, 2021 17:54
Download Funds
---
title: "Funds"
output:
html_document:
df_print: paged
---
```{r include=FALSE, results="hide"}
library(dplyr)
# Instructions how to transfer several directories from one repo to another
# while preserving the history
git clone <git dest> dest
git clone <git src> src
# Prepare the source repo
cd src
git checkout <branch from where to copy the direcoties>
@clody69
clody69 / git-mv-with-history
Created September 6, 2016 15:06 — forked from emiller/git-mv-with-history
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@clody69
clody69 / gist:b28676ba0ab271fba9aa2ccba9af943d
Created July 20, 2016 16:46
Example of Json serialization from controller
//Example here
Example of Json serailization
module GeoConverter
R_MAJOR = 6378137.0 #Equatorial Radius, WGS84
R_MINOR = 6356752.314245179 #defined as constant
def to_rad(d)
d * (Math::PI / 180.0)
end
@clody69
clody69 / server.rb
Last active December 15, 2015 20:59
Password-less Authentication by email. Inspired by some of Luke's writings on login and password usability issues (http://www.lukew.com/ff/entry.asp?1487, http://alistapart.com/article/signupforms), I have decided to test an authentication mechanism without passwords. In simple terms this can be seen as a combination of the "remember me" and "fo…
require 'sinatra'
require 'haml'
$users = {'john' => {:roles => [:user] }, 'mike' => {:roles => [:user, :admin] } }
$tokens = {'123' => {:username => 'john', :expires_at => Time.now+60}}
helpers do
def authenticate_user!
@auth_token = auth_token
if $tokens.has_key?(@auth_token) && !$tokens[@auth_token][:expires_at].nil? && $tokens[@auth_token][:expires_at] > Time.now
@clody69
clody69 / recommend.rb
Created September 26, 2012 17:50
Movie Recommendation Engine with Neography, Cypher and Neo4j
# An example how to implement a movie recommendation engine using the neography gem
# It's based on Marko Rodriguez article http://markorodriguez.com/2011/09/22/a-graph-based-movie-recommender-engine/
# but here we use Cypher instead of Gremlin
#
# To run the example you have to install neo4j and the neography gem
# You can download the data files from http://www.grouplens.org/node/73
require 'neography'
neo = Neography::Rest.new("http://localhost:7474")