Skip to content

Instantly share code, notes, and snippets.

View unixc3t's full-sized avatar
💢
coding

rudy unixc3t

💢
coding
View GitHub Profile
@unixc3t
unixc3t / RAILS_CHEATSHEET.md
Created September 7, 2023 13:08 — forked from mdang/RAILS_CHEATSHEET.md
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before

@unixc3t
unixc3t / the % notation in ruby.md
Created July 17, 2023 13:39 — forked from jakimowicz/the % notation in ruby.md
%Q, %q, %W, %w, %x, %r, %s, %I, %i

%Q, %q, %W, %w, %x, %r, %s, %i

Perl-inspired notation to quote strings: by using % (percent character) and specifying a delimiting character.

Any single non-alpha-numeric character can be used as the delimiter, %[including these], %?or these?, %~or even these things~.

Strings

% or %Q

VSCode italic font settings

Add this to settings.json (cmd ,):

{
  "editor.fontFamily": "Operator Mono, Fira Code iScript, Menlo, Monaco, 'Courier New', monospace",
  "editor.fontLigatures": true,
  "editor.tokenColorCustomizations": {
    "textMateRules": [
      {
@unixc3t
unixc3t / List.vue
Created December 16, 2019 03:00 — forked from Akryum/List.vue
Vue - onScrollBottom composable function
<script>
import { ref } from '@vue/composition-api'
import { onScrollBottom } from '@/scroll'
export default {
setup () {
function loadMore () {
// ...
}
@unixc3t
unixc3t / gist:1cbb7abcfbe51ec109ea9633c86b3e99
Created August 3, 2019 07:23 — forked from Shemeikka/gist:11f196884212dc650e828c2f71c4bddf
Elixir Genserver callbacks and return values
# GenServer callbacks and return values
## init(args)
{:ok, state}
{:ok, state, timeout}
:ignore
{:stop, reason}
## handle_call(msg, {from, ref}, state)
@unixc3t
unixc3t / phx-1.4-upgrade.md
Created July 29, 2019 03:19 — forked from chrismccord/phx-1.4-upgrade.md
Phoenix 1.3.x to 1.4.0 Upgrade Guides

Phoenix 1.4 ships with exciting new features, most notably with HTTP2 support, improved development experience with faster compile times, new error pages, and local SSL certificate generation. Additionally, our channel layer internals receiveced an overhaul, provided better structure and extensibility. We also shipped a new and improved Presence javascript API, as well as Elixir formatter integration for our routing and test DSLs.

This release requires few user-facing changes and should be a fast upgrade for those on Phoenix 1.3.x.

Install the new phx.new project generator

The mix phx.new archive can now be installed via hex, for a simpler, versioned installation experience.

To grab the new archive, simply run:

@unixc3t
unixc3t / deeply_nested.exs
Created May 28, 2019 03:54 — forked from gvaughn/deeply_nested.exs
Elixir get_in with nested maps and lists
defmodule DeeplyNested do
def get_nat_ip(input) do
steps = [first_map_with_key("accessConfigs"),
first_map_with_key("natIP")
]
get_in(input, steps)
end
defp first_map_with_key(key) do
@unixc3t
unixc3t / enzyme_render_diffs.md
Created March 14, 2019 04:53 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@unixc3t
unixc3t / Knex-Migrations-Seeding.md
Created January 30, 2019 13:37 — forked from NigelEarle/Knex-Migrations-Seeding.md
Migration and seeding instructions using Knex.js!

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

@unixc3t
unixc3t / 开启xterm终端256色和终端下vim 256色
Last active December 1, 2018 02:58 — forked from deneschen/开启xterm终端256色和终端下vim 256色
开启xterm终端256色和终端下vim 256色
相同的colorschema,vim和gvim的颜色差距还是很大的,因为gvim使用X的颜色,而vim只能使用终端提供的颜色,所以造成了二者的显示差异。
xterm开启256色
现在的终端模拟器早就支持256色了,不过默认可能还是8色的。
开启xterm终端,查看xterm终端支持的颜色
命令:
$ tput colors
8