This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ostruct' | |
css = File.read('apps/src/stylesheets/sagamore/_buttons.scss').split("\n") | |
find_images = -> line { line[/"(.+)"/]; $1 } | |
check_for_file = -> name { OpenStruct.new(name: name, exists: File.exists?("apps/src/images/icons/#{name}.png")) } | |
format_filenames = -> file_exists { OpenStruct.new(name: (file_exists.name + '.png' + ' ' * 20)[0, 20], exists: file_exists.exists) } | |
print_results = -> file_exists { puts "#{file_exists.name}\t #{file_exists.exists ? '✅' :'⛔'}" } | |
css.map(& find_images).compact.map(& check_for_file).map(& format_filenames).map(& print_results) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BottomlessHash < Hash | |
def initialize | |
super &-> h, k { h[k] = self.class.new } | |
end | |
def self.from_hash(hash) | |
new.merge(hash) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'paleta' | |
to_paleta = ->(color) { Paleta::Color.new(:hex, color) rescue nil } | |
to_div = ->(str) { | |
"<div style='font-family: sans-serif; width: 5em; height: 3em; | |
line-height: 3em; display: inline-block; text-align: center; | |
margin: 0.25em; border-radius: 0.25em; padding: 1em; | |
background: ##{str}'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# global $ | |
React = require('react') | |
class Drawer extends React.Component | |
@defaultProps: -> | |
payload: null, | |
drawerOpened: false | |
notFound: -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
class Drawer extends Component { | |
getDefaultProps() { | |
return { | |
payload: null, | |
drawerOpened: false | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
months: | |
['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] | |
render: -> | |
DOM.select | |
onChange: @onMonthChange | |
value: @props.date.getMonth() | |
DOM.option( | |
value: i, key: i, @months[i] | |
) for i in [0..(@months.length-1)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'paleta' | |
colors = %w( 669900 66FF00 66CCFF 6699FF 6633FF ) | |
to_color = ->(color) { Paleta::Color.new(:hex, color) } | |
to_div = ->(color) { "<div style='width: 3em; height: 3em; background: ##{color}; float: left'></div>" } | |
puts colors.uniq.map(& to_color).sort_by(&:hue).map(&:hex).map(& to_div) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (grunt) -> | |
# configuration | |
grunt.initConfig | |
# grunt sass | |
sass: | |
compile: | |
options: | |
style: 'expanded' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class @Equalizer | |
constructor: (selector) -> | |
@init $(selector) | |
init: ($collection)-> | |
@attachTo($collection) if $collection.length | |
attachTo: ($collection) -> | |
@collection = $collection | |
@setTimeoutFunction(@equalizeHeight, @collection) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Page | |
has_many :blocks, -> { ordered }, dependent: :destroy | |
attr_accessors :title | |
def visible_blocks | |
@visible_block ||= blocks.current_locale.map(&:blockable) | |
end | |
end | |
class Block |