Skip to content

Instantly share code, notes, and snippets.

@marekciupak
marekciupak / validating_http_parameters.md
Last active July 27, 2024 02:20
Ruby on Rails: Validating HTTP parameters

Validating HTTP parameters

Let's say you need to handle the following action:

class UsersController < ApplicationController
  def update
    user = User.find(id)
    result = update_user(user, attrs)
    
@zhangshine
zhangshine / tinymce-react-nextjs.md
Last active November 23, 2024 15:22
NextJs- React - Self hosted TinyMCE
  1. Install (TinyMCE 5.x)
npm install --save tinymce @tinymce/tinymce-react copy-webpack-plugin
  1. Copy static files(tinymce skins) to public folder. Edit file next.config.js
const path = require('path');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
@omedale
omedale / binary_tree.rb
Created May 7, 2020 09:45
Binary tree
class BinarySearchTree
class Node
attr_reader :key, :left, :right
#On initialization, the @key variable is set. This is used in the insert method below as the parent for the @left and @right nodes.
def initialize( key )
@key = key
@left = nil
@right = nil
end
@phortuin
phortuin / postgres.md
Last active March 9, 2025 22:22
Set up postgres + database on MacOS (M1)

Based on this blogpost.

Install with Homebrew:

$ brew install postgresql@14

(The version number 14 needs to be explicitly stated. The @ mark designates a version number is specified. If you need an older version of postgres, use postgresql@13, for example.)

Vim Manipulation Cheat Sheet

Action

Key Result
v select
y copy (yank)
c change
d delete