CLICK ME
yes, even hidden code blocks!
print("hello world!")| # For each database: | |
| ALTER DATABASE century21_development CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; | |
| # For each table: | |
| SELECT CONCAT('ALTER TABLE `', TABLE_NAME,'` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;') AS mySQL FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA= "century21_development" | |
| # For each column: | |
| select CONCAT('ALTER TABLE `', TABLE_SCHEMA, '.', TABLE_NAME,'` CHANGE ',COLUMN_NAME,' ', COLUMN_NAME, ' ', DATA_TYPE,'(',CHARACTER_MAXIMUM_LENGTH,') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;') as column_alter from INFORMATION_SCHEMA.COLUMNS WHERE DATA_TYPE IN('varchar', 'text') AND TABLE_SCHEMA = 'century21_development' |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.
elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParentelem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeightelem.getClientRects(), elem.getBoundingClientRect()| import { Component } from "React"; | |
| export var Enhance = ComposedComponent => class extends Component { | |
| constructor() { | |
| this.state = { data: null }; | |
| } | |
| componentDidMount() { | |
| this.setState({ data: 'Hello' }); | |
| } | |
| render() { |
React now supports the use of ES6 classes as an alternative to React.createClass().
React's concept of Mixins, however, doesn't have a corollary when using ES6 classes. This left the community without an established pattern for code that both handles cross-cutting concerns and requires access to Component Life Cycle Methods.
In this gist, @sebmarkbage proposed an alternative pattern to React mixins: decorate components with a wrapping "higher order" component that handles whatever lifecycle methods it needs to and then invokes the wrapped component in its render() method, passing through props.
While a viable solution, this has a few drawbacks:
| Architecture description | |
| - | |
| Aggregator | |
| Orchestrates the overall process from fetching to updating the db, | |
| scheduling and managing aggregator jobs and their stages for different modules | |
| does: | |
| fetch :all | latest - accepts a block with strategy to determine latest | |
| jobs :all | :current - AggreagationJob - status, stop, pause, resume |
| // Mixin that allows to specify arbitrary CSS properties with | |
| // unitless numbers. The output has rem unit with pixel fallback. | |
| // Shorthand assignments are supported too! | |
| $base_line: 10; | |
| @mixin rem($property, $values, $important:"") | |
| { | |
| // Placeholder variables | |
| $shorthand_px: ""; | |
| $shorthand_rem: ""; |
| # config/initializers/char_converter.rb | |
| require 'uri' | |
| module Support | |
| class CharConverter | |
| def initialize(app) | |
| @app = app | |
| end |
| #!/usr/bin/env ruby | |
| # | |
| # Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156) | |
| # | |
| # ## Advisory | |
| # | |
| # https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion | |
| # | |
| # ## Caveats | |
| # |
| namespace :routes do | |
| desc "Writes doc/routes.html. Requires Graphviz (dot)" | |
| task :visualizer => :environment do | |
| File.open(Rails.root.join('doc', 'routes.html'), 'wb') do |f| | |
| f.write Rails.application.routes.router.visualizer | |
| end | |
| end | |
| end |