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
class Object | |
def blank? | |
respond_to?(:empty?) ? empty? : !self | |
end | |
def present? | |
!blank? | |
end | |
end |
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
<square> | |
<button onclick={opts.click}>{opts.val}</button> | |
<style> | |
:scope { | |
display: block; | |
background: #fff; | |
border: 1px solid #999; | |
float: left; | |
height: 34px; |
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
<board> | |
<square each={square, i in opts.squares} click={() => parent.opts.click(i)} val={square} no-reorder></square> | |
<style> | |
:scope { | |
display: block; | |
width: calc(36px * 3); | |
} | |
.status { | |
margin-bottom: 10px; |
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
<game> | |
<board squares={current.squares} click={handleClick}></board> | |
<div class="game-info"> | |
<div>{ status }</div> | |
<ol if={moves}> | |
<li each={moves} key={move}> | |
<button onClick={() => jumpTo(move)}>{desc}</button> | |
</li> | |
</ol> | |
</div> |
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
class Luhn | |
def self.valid?(string) | |
transformed = string.gsub(/ /,'') #Remove spaces | |
return false if transformed.length < 1 #Return false if length less than 1 | |
return false if transformed.match?(/\D/) #Return false if any non digit characters | |
# Reverse the string Scan for 2 capture groups | |
transformed = transformed.reverse.scan(/(.)(.)/).each do |pair| | |
# Turn both items into integers | |
pair[0] = pair[0].to_i | |
pair[1] = pair[1].to_i |
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
<app> | |
<h1>Hello</h1> | |
<router> | |
<ul> | |
<li> | |
<a href="/child">Child</a> | |
</li> | |
</ul> | |
<route path="/child"> | |
<child something={ doSomething }></child> |
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
<app> | |
<h1>Hello</h1> | |
<router> | |
<ul> | |
<li> | |
<a href="/child">Child</a> | |
</li> | |
</ul> | |
<child something={ doSomething }></child> | |
</router> |
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
version: '2' | |
services: | |
base: | |
image: {{image}} | |
volumes: | |
- .:{{dir}} | |
- {{volume}}:{{dir}}/node_modules | |
working_dir: {{dir}} | |
init: | |
extends: |
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
#!/bin/bash | |
PATH=./node_modules/.bin:$PATH | |
function dockup { | |
temp=${temp:-tmp} | |
builder="node.docker-compose.builder.tpl.yml" | |
compose="node.docker-compose.tpl.yml" | |
builderOut="docker-compose.builder.yml" | |
composeOut="docker-compose.yml" | |
image=${image:-node:12.16.2} |
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
version: '3.7' | |
services: | |
nginx: | |
image: nginx:latest | |
volumes: | |
- ./default.conf:/etc/nginx/conf.d/default.conf:ro | |
ports: | |
- 80:80 | |
{{name}}: |
OlderNewer