Skip to content

Instantly share code, notes, and snippets.

View damaon's full-sized avatar
🍌
Banana

DT damaon

🍌
Banana
View GitHub Profile
@damaon
damaon / lodash-transform.js
Created December 14, 2017 15:37 — forked from robtarr/lodash-transform.js
jscodeshift - replace `_.thing(...)` with `thing(...)` and add `import {thing} from 'lodash'`
export default (fileInfo, api) => {
const j = api.jscodeshift;
const methods = [];
const root = j(fileInfo.source);
const body = root.find(j.Program).get('body', 0).node;
const { comments } = body;
delete body.comments
root.get().node.comments = comments;
@damaon
damaon / slim-redux.js
Created October 6, 2015 07:09 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
class BirthdayGenerator
def soon_to_be_celebrants
User.ordered_by_soonest_birthday
.where( birthday_month: 4.times.map{ |i| i.months.from_now.month } )
.where.not("birthday_month = :month AND birthday_day < :day", { month: Date.today.month, day: Date.today.day } )
end
end