This file contains hidden or 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
| function callback() { | |
| (function ($) { | |
| var h = $(window).height() + 'px', | |
| w = '25em', | |
| g = '2em', | |
| r = '1px solid #eee', | |
| most = 0, | |
| content = $('body'); | |
| if ($('#content').length == 1) { | |
| content = $('#content'); |
This file contains hidden or 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
| // @see http://www.quora.com/Web-Development/What-are-the-most-interesting-HTML-JS-DOM-CSS-hacks-that-most-web-developers-dont-know-about | |
| // @see http://qr.ae/Khvbr | |
| var s=document.createElement('style'); | |
| s.textContent = "<style> * { background-color: rgba(255,0,0,.2) !important} * * { background-color: rgba(0,255,0,.2) !important} * * * { background-color: rgba(0,0,255,.2) !important} * * * * { background-color: rgba(255,0,255,.2) !important} * * * * * { background-color: rgba(0,255,255,.2) !important} * * * * * * { background-color: rgba(255,255,0,.2) !important}</style>"; | |
| document.getElementsByTagName('head')[0].appendChild(s); |
This file contains hidden or 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
| background: linear-gradient(38deg, #20bc94, #757eba, #804598); | |
| background-size: 600% 600%; | |
| -webkit-animation: gradient-rotate 29s ease infinite; | |
| -moz-animation: gradient-rotate 29s ease infinite; | |
| -o-animation: gradient-rotate 29s ease infinite; | |
| animation: gradient-rotate 29s ease infinite; | |
| @-webkit-keyframes gradient-rotate { | |
| 0%{background-position:0% 51%} | |
| 50%{background-position:100% 50%} | |
| 100%{background-position:0% 51%} |
This file contains hidden or 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 | |
| # # Simple script to handle multi-line logs. | |
| # Adjust the global vars as needed. | |
| # | |
| # # Usage | |
| # | |
| # > chmod +x log_pipe.rb | |
| # > tail -f log/development.log | ./log_pipe.rb | |
| # |
This file contains hidden or 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
| hardstatus alwayslastline | |
| hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c %{g}]' |
This file contains hidden or 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 'coderay' | |
| require 'open3' | |
| # # Dependencies | |
| # `coderay` is a ruby gem. | |
| # Install it with: | |
| # ``` | |
| # $ gem install coderay | |
| # ``` |
This file contains hidden or 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
| # Load this file in your `.pryrc` | |
| # | |
| # load 'path/to/pry_sql.rb' | |
| # | |
| # See how to use this by running: `psql --help` | |
| # Originally created for Rails 3. | |
| # Updated to Rails 6 | |
| module Rails | |
| class DBConsole | |
| APP_PATH = Rails.root.join('config', 'application') |
This file contains hidden or 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
| SELECT | |
| cal_date, | |
| max(CASE WHEN hour = 0 THEN up_pct END) AS hour_0, | |
| max(CASE WHEN hour = 1 THEN up_pct END) AS hour_1, | |
| max(CASE WHEN hour = 2 THEN up_pct END) AS hour_2, | |
| max(CASE WHEN hour = 3 THEN up_pct END) AS hour_3, | |
| max(CASE WHEN hour = 4 THEN up_pct END) AS hour_4, | |
| max(CASE WHEN hour = 5 THEN up_pct END) AS hour_5, | |
| max(CASE WHEN hour = 6 THEN up_pct END) AS hour_6, | |
| max(CASE WHEN hour = 7 THEN up_pct END) AS hour_7, |
This file contains hidden or 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
| SELECT | |
| cal_date, | |
| max(CASE WHEN hour = 0 THEN up_pct END) AS hour_0, | |
| max(CASE WHEN hour = 1 THEN up_pct END) AS hour_1, | |
| max(CASE WHEN hour = 2 THEN up_pct END) AS hour_2, | |
| max(CASE WHEN hour = 3 THEN up_pct END) AS hour_3, | |
| max(CASE WHEN hour = 4 THEN up_pct END) AS hour_4, | |
| max(CASE WHEN hour = 5 THEN up_pct END) AS hour_5, | |
| max(CASE WHEN hour = 6 THEN up_pct END) AS hour_6, | |
| max(CASE WHEN hour = 7 THEN up_pct END) AS hour_7, |
This file contains hidden or 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
| alias λ lambda | |
| sadd = λ {|ns, a| [*ns, a].sort } | |
| hsort = λ {|h| Hash[h.sort] } | |
| hadd = λ {|h, n, g| h.merge(g => sadd.(h[g], n)) } | |
| school = λ {|gs| School.new(gs) } | |
| School = Struct.new(:gs) do | |
| define_method :add, λ {|n, g| (school . (hsort . (hadd . (to_hash, n, g)))) } | |
| define_method :to_hash, λ {| | gs || {} } |