Skip to content

Instantly share code, notes, and snippets.

View diogo-almeida's full-sized avatar

Diogo Almeida diogo-almeida

View GitHub Profile
@coleoguy
coleoguy / gist:10136883
Last active September 9, 2015 20:37
just a simple sliding window function
slideFunct <- function(data, window, step){
total <- length(data)
spots <- seq(from = 1, to = (total - window + 1), by = step)
result <- vector(length = length(spots))
for(i in 1:length(spots)){
result[i] <- mean(data[spots[i]:(spots[i] + window - 1)])
}
return(result)
}
@sebkopf
sebkopf / gtk_install.md
Last active February 22, 2024 06:10
Installation information for R with GTK on Windows/Mac OS

Installation information for R with GTK+

Windows

Install the newest version of R. Additionally, I highly recommend R-Studio for working with R regularly (but the basic command line will work just fine for most applications). Once R is installed, you can install GTK directly from within R (details below). In short:

  1. From the R command line (e.g. in R-Studio), install the RGtk2 package by running: install.packages("RGtk2", depen=T)
    This might fail with the warning that package ‘RGtk2’ is not available (for R version xxx) if your version of R has been released very recently. If so, just run install.packages("RGtk2", depen=T, type="source") instead to install the RGtk2 package directly from its source code (this might take a few
@swayson
swayson / lsa_hack.r
Created February 26, 2014 06:56 — forked from rpietro/lsa_hack.r
Analyze Text Similarity with R: Latent Semantic Analysis and Multidimentional Scaling
# script stolen from http://goo.gl/YbQyAQ
# install.packages("tm")
# install.packages("ggplot2")
# install.packages("lsa")
# install.packages("scatterplot3d")
#install.packages("SnowballC")
#if !(require('SnowballC')) then install.packages("SnowballC")
library(tm)
library(ggplot2)
@stig
stig / Clojure.plist
Created February 3, 2014 00:17
Clojure language module based on the newlisp package by Seth Dillingham and Pete B. Anonymous.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!--
ABOUT:
Clojure language module based on the newlisp package by
Seth Dillingham <seth.dillingham@gmail.com>
and Pete B. Anonymous.
@tuananh
tuananh / archive.html
Created November 12, 2013 15:16
Group posts by month in Jekyll archive page
---
layout: default
title: Archive
---
<div class="post">
<h2>Archive</h2>
<ul>
{% for post in site.posts %}
{% unless post.next %}
@johndharrison
johndharrison / server.R
Created October 21, 2013 22:30
R Shiny regression example
library(RJSONIO)
shinyServer(function(input, output, session) {
output$test <- renderUI({
noPoints <- as.integer(input$obs)
series <- toJSON(cbind(seq(88, 266, by = (266-88)%/%(noPoints-1)), 113))
tags$script(HTML(
paste0("$(document).ready(function () {
@fractaledmind
fractaledmind / EXPORT ALL SKIM NOTES TO EVERNOTE WITH HYPERLINKS (Complete)
Last active January 9, 2017 01:36
REQUIRED PROGRAMS: - Skim (pdf viewer and annotator) - Evernote (cloud based note app) This script will (as the title suggests) export all of you Skim notes directly to Evernote with hyperlinks. It integrates the GENERATE TOP 3 NOTES WITH SYSTEM URL script that will put 3 notes at the top of the PDF with linking information. This means your PDF …
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@don1138
don1138 / font-stacks.css
Last active April 25, 2024 15:41
CSS Modern Font Stacks
/* Modern Font Stacks */
/* System */
font-family: system, -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif;
/* System (Bootstrap 5.2.0) */
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
/* Times New Roman-based serif */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;
@wch
wch / app.r
Last active December 18, 2023 16:41
Shiny example app with dynamic number of plots
max_plots <- 5
ui <- fluidPage(
headerPanel("Dynamic number of plots"),
sidebarPanel(
sliderInput("n", "Number of plots", value=1, min=1, max=5)
),