Skip to content

Instantly share code, notes, and snippets.

View adilapapaya's full-sized avatar

adilapapaya

View GitHub Profile
@adilapapaya
adilapapaya / examples.R
Last active August 29, 2015 14:19 — forked from skranz/s_dplyr
# Examples
library(dplyr)
source("s_dplyr.R");
# Original usage of dplyr
mtcars %>%
filter(gear == 3,cyl == 8) %>%
select(mpg, cyl, hp:vs)
# Select user specified cols.
@miguelmota
miguelmota / base64-to-png.js
Created September 24, 2014 21:33
Base64 to PNG in Node.js
var fs = require('fs');
var path = require('path');
function base64ToPNG(data) {
data = data.replace(/^data:image\/png;base64,/, '');
fs.writeFile(path.resolve(__dirname, '../tmp/image.png'), data, 'base64', function(err) {
if (err) throw err;
});
}
@mbostock
mbostock / .block
Last active April 18, 2024 20:31
Prim’s Algorithm III
license: gpl-3.0
@adilapapaya
adilapapaya / README.md
Created March 31, 2014 19:42
A Better Meteor Template

The Setup

Note: app-name corresponds to the name of your app

Create the app
meteor create app-name
cd app-name
rm app-name* 
@adilapapaya
adilapapaya / README
Last active June 27, 2020 11:58
Export Table Data to CSV using Javascript
Example code for exporting data in a table to a csv file.
@skranz
skranz / s_dplyr
Created March 21, 2014 07:48
Wrappers to dplyr's data modification functions like arrange, select,... that work with string arguments.
# Helper functions that allow string arguments for dplyr's data modification functions like arrange, select etc.
# Author: Sebastian Kranz
# Examples are below
#' Modified version of dplyr's filter that uses string arguments
#' @export
s_filter = function(.data, ...) {
eval.string.dplyr(.data,"filter", ...)
}
@low-decarie
low-decarie / dual_dendogram_tile_plot
Last active July 21, 2023 22:17
Given a data matrix, this produces a tile plot with dendograms for each axis
dual_dendogram_tile_plot <- function(data.matrix, main="Title"){
#Dual dendrogram ############
x <- data.matrix
dd.col <- as.dendrogram(hclust(method="ward",dist(x)))
col.ord <- order.dendrogram(dd.col)
dd.row <- as.dendrogram(hclust(method="ward",dist(t(x))))
row.ord <- order.dendrogram(dd.row)
@ianstormtaylor
ianstormtaylor / no-olark.css
Created May 7, 2013 18:47
A quick snippet to hide the Olark chat module on certain pages.
/**
* Hide Olark.
*/
#habla_beta_container_do_not_rely_on_div_classes_or_names {
display: none;
}
@joscha
joscha / meteor-async.md
Last active August 29, 2017 06:51 — forked from possibilities/meteor-async.md
Meteor Async Guide

From Meteor's documentation:

In Meteor, your server code runs in a single thread per request, not in the asynchronous callback style typical of Node. We find the linear execution model a better fit for the typical server code in a Meteor application.

This guide serves as a mini-tour of tools, trix and patterns that can be used to run async code in Meteor.

Basic async

Sometimes we need to run async code in Meteor.methods. For this we create a Future to block until the async code has finished.