Skip to content

Instantly share code, notes, and snippets.

Avatar

Boris Barroso boriscy

View GitHub Profile
View Modal.svelte
<script lang="ts">
import { createEventDispatcher } from "svelte"
import { fade, fly } from "svelte/transition"
import Fa from "svelte-fa"
import { faTimes } from "@fortawesome/free-solid-svg-icons"
let open = false
export let closeButton = true
export let closeOnEsc = true
@boriscy
boriscy / .rubocop.yml
Created Apr 21, 2021 — forked from jhass/.rubocop.yml
My preferred Rubocop config
View .rubocop.yml
AllCops:
RunRailsCops: true
# Commonly used screens these days easily fit more than 80 characters.
Metrics/LineLength:
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
Metrics/MethodLength:
View animation.css
/*Rotation*/
.box {
animation: rotate 1s ease infinite;
}
@keyframes rotate {
0% {
-webkit-transform: rotate(0);
transform: rotate(0);
}
@boriscy
boriscy / Affinity.md
Last active Mar 1, 2021
Affinity Designer tips
View Affinity.md

Use Shift to create perfect circle

Duplicate and rotate

To duplicate in a circle

  • Create a circle,
  • Create an object that we want to duplicate
  • Set the object center equal to the circle using the crosshair tool
  • Use Command+J go to the transform object set the amount of rotation
  • Use Command+J for the next objets
@boriscy
boriscy / form.jsx
Created Feb 20, 2021
Submit form with file react
View form.jsx
import React, {useState} from "react"
export default function() {
const [cont, setCont] = useState("")
const [file, setFile] = useState(null)
const handleSubmit = async (e) => {
e.preventDefault()
const formData = new FormData()
formData.append("body", JSON.stringify(cont))
@boriscy
boriscy / git.md
Last active Mar 4, 2021
List of commands for git
View git.md

Search content in the history

git grep <regexp> $(git rev-list --all)`
git log -p | grep <pattern>

View history of a folder

git log -- path/to/folder
git log -- path/to/folder/*
View 20200716142101_add_unique_project_qualification.rb
class AddUniqueProjectQualification < ActiveRecord::Migration[6.0]
def up
# Stores before removing repeated
sql = <<~SQL
CREATE TEMPORARY TABLE t_project_qualifications AS (
SELECT project_id, qualification_id
FROM project_qualifications pq
GROUP BY project_id, qualification_id HAVING count(*) > 1
)
SQL
View posts.json
[
{
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
},
{
"userId": 1,
"id": 2,
@boriscy
boriscy / getUrlParams.js
Last active Nov 29, 2018
replace of jQuery.param
View getUrlParams.js
/**
* Converts an Object to params similar to jQuery.param function
* @param {Object} params
* @param {Array} keys
* @return {String}
*/
getUrlString (params, keys = [], isArray = false) {
const p = Object.keys(params).map(key => {
let val = params[key]