Skip to content

Bump qs from 6.5.2 to 6.5.3 #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
96f0f7e
🌟 add: tip for puts a variable
hugolgst Oct 23, 2017
153ed54
🌟 add: lot of tips
hugolgst Oct 23, 2017
bb51913
🆙 update: categories
hugolgst Oct 23, 2017
14131e3
🆙 update: categories again
hugolgst Oct 23, 2017
104f55d
🌟 add: single char
hugolgst Oct 23, 2017
7b98810
🌟 add: array join
hugolgst Oct 23, 2017
4962d18
🌟 add: number shortcut
hugolgst Oct 23, 2017
d75136d
🌟 add: number print
hugolgst Oct 23, 2017
afbd733
🌟 add: print shortcut
hugolgst Oct 23, 2017
66805da
🌟 add: do end block
hugolgst Oct 23, 2017
6cab91f
🌟 add: array shortcut
hugolgst Oct 23, 2017
1129d21
🌟 add: backslash n shortcut
hugolgst Oct 23, 2017
c2391d7
🌟 add: range member
hugolgst Oct 23, 2017
b09162a
🌟 add: range to array
hugolgst Oct 23, 2017
3e3aea6
🔙back: remove gitignore
hugolgst Oct 23, 2017
47c8e3b
Set theme jekyll-theme-cayman
hugolgst Oct 24, 2017
c95397b
🆙 update: style
hugolgst Oct 24, 2017
1ea5fa2
🆙 update: stylish
hugolgst Oct 24, 2017
b261d6f
🌟 add: each to map
hugolgst Oct 24, 2017
9db19ad
🌟 add: arrays compact
hugolgst Oct 24, 2017
fbdcb37
🌟 add: -1
hugolgst Oct 24, 2017
d4d7ef2
🆙 update: style
hugolgst Oct 24, 2017
ea00def
🌟 add: last gets
hugolgst Oct 25, 2017
0ec0c28
🌟 add: .uniq
hugolgst Oct 29, 2017
6bb8cf0
🌟 Add methods
hugolgst Nov 4, 2017
ac409d9
🌟 Add array shifting
hugolgst Nov 5, 2017
1c18da4
🎁 Add writing repetition
hugolgst Nov 12, 2017
4e538fc
🎁 Add puts
hugolgst Nov 15, 2017
681fa68
Set theme jekyll-theme-cayman
hugolgst Apr 14, 2019
a532a71
Changing quotes into question mark
hugolgst Apr 14, 2019
7a96003
Move the doc to vuepress
hugolgst May 7, 2019
3f8e34e
Prepare for netlify build
hugolgst May 7, 2019
8d01201
audit fix
hugolgst May 7, 2019
7cfe1a1
audit fix
hugolgst May 7, 2019
1769336
Change netlify config
hugolgst May 7, 2019
dabf6a4
Update netlify.toml
hugolgst May 8, 2019
df8482c
Change accent color to red and add netlify build badge to the README
hugolgst May 8, 2019
29af9b2
Update README.md
hugolgst May 8, 2019
03187fe
Update README.md
hugolgst May 8, 2019
ccae969
Bump lodash.template from 4.4.0 to 4.5.0
dependabot[bot] Jul 11, 2019
438fcc9
Merge pull request #1 from ananagame/dependabot/npm_and_yarn/lodash.t…
hugolgst Jul 11, 2019
372b52e
Bump acorn from 6.1.1 to 6.4.1
dependabot[bot] Mar 14, 2020
55fd749
Merge pull request #2 from hugolgst/dependabot/npm_and_yarn/acorn-6.4.1
hugolgst Mar 14, 2020
f9c9034
Bump mixin-deep from 1.3.1 to 1.3.2
dependabot[bot] Mar 14, 2020
60324f3
Bump lodash from 4.17.11 to 4.17.15
dependabot[bot] Mar 14, 2020
e0e406d
Merge pull request #3 from hugolgst/dependabot/npm_and_yarn/mixin-dee…
hugolgst Mar 14, 2020
f60262a
Merge pull request #4 from hugolgst/dependabot/npm_and_yarn/lodash-4.…
hugolgst Mar 14, 2020
3396a96
Bump qs from 6.5.2 to 6.5.3
dependabot[bot] Dec 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
#Remove commitrun file
commitrun.sh
node_modules/
35 changes: 2 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,3 @@
# Introduction
Some of the best golfing tips in Ruby.
Just browse categories and find the tricks you can do to reduce your code.
# ruby-codegolf [![Netlify Status](https://api.netlify.com/api/v1/badges/b5e48fbb-9696-4acb-9e87-83988c41ee5c/deploy-status)](https://app.netlify.com/sites/ruby-codegolf/deploys)

# Summary
* [Objects](#Objects)
* [Variables](#Variables)
* [Strings](#Strings)
* [Conditions](#Conditions)

# Objects
## Variables
- Define variables with one letter
```ruby
sentence="This is a good sentence."
s="This is a good sentence." #Better
```

- Multiple variable assignement
```ruby
a=2017
b=50
c="Fish"

a,b,c=2017,50,"Fish" #Better
```

## Strings

## Arrays

## Integers

## Conditions
[The documenation](https://ruby-codegolf.netlify.com/)
24 changes: 24 additions & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
title: 'ruby-codegolf',
description: 'Some tips for golfing in Ruby',
head: [
['meta', { name: 'og:type', content: 'website' }],
['meta', { name: 'og:title', content: 'Ruby code golf tips' }],
['meta', { name: 'og:description', content: 'Code golf tips - Some tips for golfing in Ruby' }],
['meta', { name: 'theme-color', content: '#e53033' }]
],
themeConfig: {
nav: [
{ text: 'Github', link: 'https://github.com/ananagame/ruby-codegolf' },
],
sidebar: [
'/variables',
'/strings',
'/arrays',
'/ranges',
'/integers',
'/conditions',
'/others'
]
}
}
5 changes: 5 additions & 0 deletions docs/.vuepress/override.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// showing default values
$accentColor = #ce1e39
$textColor = #2c3e50
$borderColor = #eaecef
$codeBgColor = #282c34
4 changes: 4 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ruby-codegolf

You can find here some tips to play code golf with Ruby
And you can add some tips by creating a PR on [Github](https://github.com/ananagame/ruby-codegolf)
59 changes: 59 additions & 0 deletions docs/arrays.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Arrays

Array assignement

```ruby
a=["Hello", "this", "is", "an", "array"]

a=%w(Hello this is an array) #Better
```

Array join

```ruby
a=[1, 2, 3]
puts a.join("+")

a=[1, 2, 3]
puts a*?+ #Better
```

Try to set your array as `$*`

```ruby
a=[]
6.times do |i|
a << i
end

6.times do |i|
$* << i
end
```

Array shift

```ruby
a=[1,2,3]
a.shift

a=[1,2,3]
a[1..-1] # Better
```

Change compact

```ruby
a=[1, nil, 2, nil, nil, 3]
a.compact

a-[nil] #Better
```

Uniq

```ruby
a.uniq

a|[]
```
16 changes: 16 additions & 0 deletions docs/conditions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Conditions

Condition shortcut

```ruby
a=true
if a
puts "Yes it's true."
end

a=true
puts "Yes it's true." if a #Better

a=true
a&&puts "Yes it's true." #The best
```
26 changes: 26 additions & 0 deletions docs/integers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Integers

Number shortcut

```ruby
a=10000

a=1e4 #Better
```

Print

```ruby
puts 547

p 547 #Better
```

-1

```ruby
a=5
(a-1) * 4

~-a * 4 #Better
```
61 changes: 61 additions & 0 deletions docs/others.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Others

Shortcut for print

```ruby
print "hello"

$><<"hello" #Better
```

Think to remove `do end` block

```ruby
6.times do |i|
puts i
end

6.times{|i|puts i} #Better
```

You can change `each` to `map`

```ruby
(0..9).to_a.each do
puts "Hello"
end

(0..9).to_a.map do
puts "Hello" #Better
end
```

You can replace your last gets by `$_`

```ruby
a=gets
puts a

gets
puts $_
```

Methods

```ruby
def a n
n*n
end

a=->n{n*n} # Better
```

Write n times w

```ruby
6.times do
puts "Hello world"
end

puts ["Hello world"] * 6 #Better
```
17 changes: 17 additions & 0 deletions docs/ranges.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Ranges

Item is member of a range

```ruby
(0..10).member?(3)

(0..10)===3 #Better
```

Range to array

```ruby
("a".."z").to_a

[*?a..?z] #Better
```
49 changes: 49 additions & 0 deletions docs/strings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Strings

String match

```ruby
a="Hello"
if a.match /[a-zA-Z]/
puts "It's a match!"
end

a="Hello"
if a=~/[a-zA-Z]/
puts "It's a match!" #Better
end
```

String repetition

```ruby
6.times do
print "Hello"
end

print "Hello"*6 #Better
```

Single char

```ruby
puts "A"

puts ?A #Better
```

Char ascii

```ruby
puts 70.chr

putc 70 #Better
```

\n shortcut

```ruby
a=gets.split "\n"

a=gets.split $/ #Better
```
28 changes: 28 additions & 0 deletions docs/variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Variables

Define variables with one letter

```ruby
sentence="This is a good sentence."
s="This is a good sentence." #Better
```

Multiple variable assignement

```ruby
a=2017
b=50
c="Fish"

a,b,c=2017,50,"Fish" #Better
```

Puts variables

```ruby
a="Anana"
puts "My name is #{a}"

$a="Anana"
puts "My name is #$a" #Better
```
3 changes: 3 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build]
command = "npm run docs:build"
publish = "docs/.vuepress/dist/"
Loading