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
# USAGE: | |
# rails runner rails-models-to-typescript-schema.rb > app/javascript/types/schema.d.ts | |
Rails.application.eager_load! | |
models = ActiveRecord::Base.descendants.reject { |i| i.abstract_class? } | |
belongs_to = true | |
has_many = true |
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
/*** | |
Copyright (c) 2016, Alexander Choporov aka CoolCmd | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | |
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDE |
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
# Have to hijack the global environment, b/c that's how invasive it is! | |
def self.wtf | |
to_return = {exception: nil, stdout: nil, stderr: nil} | |
require 'stringio' | |
$stdout = StringIO.new | |
$stderr = StringIO.new | |
to_return[:returned] = yield | |
rescue Exception | |
to_return[:exception] = $! | |
ensure |
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
var React = require('react/addons'); | |
var ReactIgnore = { | |
displayName: 'ReactIgnore', | |
shouldComponentUpdate (){ | |
return false; | |
}, | |
render (){ | |
return React.Children.only(this.props.children); | |
} |
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) -> | |
# Project configuration. | |
grunt.initConfig | |
coffee: | |
options: | |
sourceMap: false | |
app: | |
expand: true | |
cwd: 'public/js/coffee/' |
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
# | |
# Convert .bootstrap-select elements to Bootstrap Dropdown Group | |
# Assumes jQuery and Bootstrap scripts already linked | |
# !!! require jQuery 1.7.2 - 1.8.3 | |
# | |
# Expected markup: | |
# <select class="span1" id="car_engine_type" name="car[engine_type]" style="margin-left: 30px"> | |
# <option value="">fuel</option> | |
# <option value="diesel">diesel</option> | |
# <option value="gasoline">gasoline</option> |