start new:
tmux
start new with session name:
tmux new -s myname
| # Rspec Syntax Cheat Sheet | |
| ## Stub: | |
| Replacing a method with code that returns a specified result. | |
| weapon.stub(:slice) | |
| Stubbing to avoid hitting database | |
| Before: context block hits DB twice |
| abbr[title]:after // after an abbr element with title attribute | |
| { | |
| content: " (" attr(title) ")"; // display the title attribute value in parentheses | |
| } | |
| @media screen and (min-width: 1025px) // above 1025px screen width | |
| { | |
| abbr[title] | |
| { | |
| border-bottom: 1px dashed #ADADAD; // draw a dashed border under the abbr element |
| // packages | |
| //----------------------- | |
| // alignment | |
| // ruby-eval | |
| // sublime linter | |
| // origami | |
| // autofilename | |
| // javascript es6 syntax highlighting | |
| // gutter color | |
| // git gutter |
| // `unit` is `return` from Haskell | |
| // `bind` is `>>=` from Haskell, or `flatMap` from Scala | |
| var None = { | |
| bind: function (fn) { return this; }, | |
| unit: function (v) { return Option(v); }, | |
| getOrElse: function (elseValue) { return elseValue; } | |
| }; | |
| var Some = function (value) { |
| # setup data | |
| data1 = {1 => %W{ A B C D E} , 2 => %W{ A B C D E }, 3 => %W{ A B C D E }, 4 => %W{ A B C D E } } | |
| list = data1[1] | |
| def swap_list_values_to_keys(key, list) | |
| list.reduce({}) { |a, value| a.merge({key => value.downcase}.invert) } | |
| end | |
| # p swap_list_values_to_keys(1, list) | |
| # => {"a"=>1, "b"=>1, "c"=>1, "d"=>1, "e"=>1} |
| function countCSSRules() { | |
| var results = '', | |
| log = ''; | |
| if (!document.styleSheets) { | |
| return; | |
| } | |
| for (var i = 0; i < document.styleSheets.length; i++) { | |
| countSheet(document.styleSheets[i]); | |
| } | |
| function countSheet(sheet) { |
| const args = ['node', '--proxy=']; | |
| const flags = ['proxy']; | |
| let hasProxy = (arg) => flags.find(flag => arg.includes(flag)); | |
| if(args.find(hasProxy)) { | |
| console.log("proxy"); | |
| } else { | |
| console.log("error"); | |
| } |
| # Get VNC Server running on Google Cloud with Ubuntu 18.04 | |
| [Create a new Google Clound Instance](https://console.cloud.google.com/compute/instances?project=tenso-flow&folder&organizationId&duration=PT1H) | |
| ## Install a Desktop | |
| In this case ubuntu-desktop | |
| ### Install Tasksel | |
| ` | |
| sudo apt-get install aptitude tasksel | |
| ` |
| class Calculator | |
| def parse input | |
| input.split(" ") | |
| end | |
| def order_of_operations | |
| ["*", "/", "+", "-"] | |
| end |