Skip to content

Instantly share code, notes, and snippets.

@kirillshevch
kirillshevch / rails_new_options_help.md
Last active September 30, 2023 01:05
List of "rails new" options to generate a new Rails 7 application
View rails_new_options_help.md

Run rails new --help to see all of the options you can use to create a new Rails application:

Output for Rails 7+

Usage:
  rails new APP_PATH [options]

Options:
      [--skip-namespace], [--no-skip-namespace]              # Skip namespace (affects only isolated engines)
View write_into_file.go
file, err := os.Create("output.txt")
if err != nil {
log.Fatalf("Failed to create file: %s", err)
}
defer file.Close()
for key, value := range files {
line := fmt.Sprintf("%s: %s\n", key, value)
_, err := file.WriteString(line)
if err != nil {
@kirillshevch
kirillshevch / telegram_animated_sticker_ffmpeg.md
Last active April 29, 2023 11:40
How to convert video into Telegram Animated Sticker with FFmpeg (WEBM)
View telegram_animated_sticker_ffmpeg.md

How to convert video into Telegram Animated Sticker with FFmpeg (WEBM)

ffmpeg -y -i input.mov -r 30 -t 2.99 -an -c:v libvpx-vp9 -pix_fmt yuva420p -vf 'scale=512:512:force_original_aspect_ratio=decrease' output.webm

Here is a breakdown of the options:

-y - Overwrite the output file if it already exists.

View alex.js
(() => {
// config:
const likea = true // like all (skip next two if true)
const tsize = 128 // minimal amount of letters in bio
const regex = /no fwb/i // dislike if found
const likes = 1000 // maximal likes per run
const speed = 1 // timeout to let it be preloaded
const timeo = 51 // timeout to let bio be loaded
const msgtm = 200 // timeout on match
// ^
View state_pattern.rb
# State interface
class TrafficLightState
def change_state(_traffic_light)
raise 'This method should be implemented in a subclass'
end
def display_color
raise 'This method should be implemented in a subclass'
end
end
View review.pb.go
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.19.4
// source: review.proto
package storage
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
View main.go
package main
import (
"context"
"fmt"
"github.com/go-redis/redis/v8"
)
func main() {
View main.go
package main
import (
"context"
"fmt"
"protobuftest/storage"
"github.com/go-redis/redis/v8"
"google.golang.org/protobuf/proto"
)
View circle.yml
machine:
ruby:
version: 2.3.4
deployment:
staging:
branch: staging
commands:
- bundle exec cap staging deploy
production:
branch: production
View how-to-disable-cache-for-production-create-react-app.md

How to disable page caching with create-react-app

If you currently not using a service worker resulting in old production caches being used and users not getting new versions of the app.

src/index.js

Use:

import { unregister as unregisterServiceWorker } from './registerServiceWorker'