Skip to content

Instantly share code, notes, and snippets.

View jorinvo's full-sized avatar

Jorin jorinvo

View GitHub Profile
@jorinvo
jorinvo / orders.js
Created November 22, 2015 09:21
mergeOrders - cleaning db query with ramda
const sampleForRow = row => ({
id: row.samplesId,
num: row.samplesNum,
type: row.samplesType,
title: sampleTypes[row.samplesType].title
})
const fileForRow = row => ({
id: row.filesId,
name: row.filesName,
@jorinvo
jorinvo / format.js
Last active November 22, 2015 08:56
formatExcerpt - to ramda or not to ramda
export function formatExcerpt (text) {
if (!text) return
if (text.length < config.textExcerptLength) {
return text
}
// cut length and remove last word
return text
.substr(0, config.textExcerptLength)
@jorinvo
jorinvo / encodeDates.js
Last active November 20, 2015 09:52
readable?
const toISOString = ifElse(
either(isNil, compose(isEmpty, trim)),
always(null),
d => new Date(d).toISOString()
)
function toISOString (date) {
if (isNil(date) || isEmpty(date.trim())) {
return null
@jorinvo
jorinvo / en-boilerplate.js
Last active November 12, 2015 05:18
Compare timeago
module.exports = {
emptyDoc: 'Write …',
search: 'Search …',
footer: 'write lite, open source',
share: 'share',
open: 'open',
modified: 'modified',
welcome: require('./welcome.txt'),
secondsAgo: function (x) {
if (x === 1) return 'a second ago';
@jorinvo
jorinvo / package.json
Created November 4, 2015 10:07
Scripts section for a react project
{
"config": {
"port": 3000,
"api_url": "http://localhost:3000/api"
},
"scripts": {
"start": "export NODE_ENV=production; npm run build && npm run server",
"watch": "npm run server:watch & npm run test:watch & wait",
"server": "node server.js",
"server:watch": "nodemon --watch server.js server.js",
@jorinvo
jorinvo / bindActions.js
Last active August 29, 2015 14:23
miniflux
export default function bindActions (actions, render, initialState) {
var state = initialState
function update (updatedState) {
state = updatedState
render(state)
}
var boundActions = Object.keys(actions).reduce(function (o, name) {
o[name] = function () {
name creditcard
Keeley Bosco 1228-1221-1221-1431
Rubye Jerde 1228-1221-1221-1431
Celine Ankunding 1228-1221-1221-1431
Dr. Araceli Lang 1211-1221-1234-2201
Terrell Boyle 1228-1221-1221-1431
Libby Renner 1234-2121-1221-1211
Alessandro Barton 1234-2121-1221-1211
Dr. Art Grimes 1211-1221-1234-2201
Keven Purdy 1211-1221-1234-2201
@jorinvo
jorinvo / challenge.md
Last active April 21, 2023 17:14
This is a little challenge to find out which tools programmers use to get their everyday tasks done quickly.

You got your hands on some data that was leaked from a social network and you want to help the poor people.

Luckily you know a government service to automatically block a list of credit cards.

The service is a little old school though and you have to upload a CSV file in the exact format. The upload fails if the CSV file contains invalid data.

The CSV files should have two columns, Name and Credit Card. Also, it must be named after the following pattern:

YYYYMMDD.csv.

@jorinvo
jorinvo / data.json
Last active September 21, 2020 17:30
Test data for little challenge
This file has been truncated, but you can view the full file.
[
{"name":"Keeley Bosco","email":"katlyn@jenkinsmaggio.net","city":"Lake Gladysberg","mac":"08:fd:0b:cd:77:f7","timestamp":"2015-04-25 13:57:36 +0700","creditcard":"1228-1221-1221-1431"},
{"name":"Rubye Jerde","email":"juvenal@johnston.name","city":null,"mac":"90:4d:fa:42:63:a2","timestamp":"2015-04-25 09:02:04 +0700","creditcard":"1228-1221-1221-1431"},
{"name":"Miss Darian Breitenberg","email":null,"city":null,"mac":"f9:0e:d3:40:cb:e9","timestamp":"2015-04-25 13:16:03 +0700","creditcard":null},
{"name":"Celine Ankunding","email":"emery_kunze@rogahn.net","city":null,"mac":"3a:af:c9:0b:5c:08","timestamp":"2015-04-25 14:22:22 +0700","creditcard":"1228-1221-1221-1431"},
{"name":"Dr. Araceli Lang","email":"mavis_lehner@jacobi.name","city":"Yvettemouth","mac":"9e:ea:28:41:2a:50","timestamp":"2015-04-25 21:02:11 +0700","creditcard":"1211-1221-1234-2201"},
{"name":"Esteban Von","email":null,"city":null,"mac":"2d:e4:f0:dd:90:96","timestamp":"2015-04-25 21:47:09 +0700","creditcard":null},
@jorinvo
jorinvo / factorialWithLambdaCalc.js
Last active August 29, 2015 14:15
JS version of code from Jim Weirichs Talk on Lambda Calculus (https://www.youtube.com/watch?v=FITJMJjASUs)
// Y Combinator
// makes the recursion
(function(improver) {
return (function(gen) { return gen(gen) })(
function(gen) {
return improver(function(v) {
return gen(gen)(v)
})
}
)