Skip to content

Instantly share code, notes, and snippets.

View WaKeMaTTa's full-sized avatar
✔️
Verified

Mohamed Ziata WaKeMaTTa

✔️
Verified
View GitHub Profile
@Widdershin
Widdershin / ssr.md
Last active March 8, 2024 11:21
The absurd complexity of server-side rendering

In the olden days, HTML was prepared by the server, and JavaScript was little more than a garnish, considered by some to have a soapy taste.

After a fashion, it was decided that sometimes our HTML is best rendered by JavaScript, running in a user's browser. While some would decry this new-found intimacy, the age of interactivity had begun.

But all was not right in the world. Somewhere along the way, we had slipped. Our pages went uncrawled by Bing, time to first meaningful paint grew faster than npm, and it became clear: something must be done.

And so it was decided that the applications first forged for the browser would also run on the server. We would render our HTML using the same logic on the server and the browser, and reap the advantages of both worlds. In a confusing series of events a name for this approach was agreed upon: Server-side rendering. What could go wrong?

In dark rooms, in hushed tones, we speak of colours.

@pat
pat / thinking_sphinx.yml
Last active April 23, 2022 03:49
Thinking Sphinx Configuration
# Extended configuration for Thinking Sphinx can be stored in the
# config/thinking_sphinx.yml file within your application (this file was
# previously known as config/sphinx.yml in TS v1/v2).
#
# Many settings from Sphinx itself can be set here, and they'll flow through to
# the appropriate section of the generated configuration. However, some are
# used for Thinking Sphinx behaviour, and so those are documented here first.
#
# Configuration is grouped by environment, just like config/database.yml in a
# standard Rails application.
@WaKeMaTTa
WaKeMaTTa / order-rails-controller-callbacks.md
Last active July 29, 2019 12:29
Order of Rails Controller Callbacks

Order of Rails Controller Callbacks

Rails 4.x

Started GET "/" for 127.0.0.1 at 2017-05-19 14:17:18 +0200
  Processing by WelcomeController#index as HTML
    prepend_around_action
    prepend_before_action
 before_action

Templating engines and React.js

I want to make a shopify theme using react.

How shopify theming works

You have a bunch of template files that have access to global server-side variables with liquid e.g. {{ product.title }}. Think wordpress or any other theme-based system.

 /theme
@dteoh
dteoh / arel_select_star_from_table.rb
Last active December 2, 2019 14:45
Select all columns of an Arel table
users = User.arel_table
query = users.project(users[Arel.star])
@freshtonic
freshtonic / pre-commit
Last active December 4, 2021 10:33
Git commit hook to abort commits when I accidentally commit dumb shit.
#!/usr/bin/env ruby
# Checks for things that I often commit accidentally and bails out of the
# commit. To skip this pre-commit hook use `git commit --no-verify`.
checks = [
/\bddescribe\b/,
/\biit\b/,
/\bxit\b/,
/binding.pry/,
@jhjguxin
jhjguxin / how_to_concerns.md
Last active November 28, 2018 17:16 — forked from dhh/gist:1014971
how to concerns with rails 3
@zenorocha
zenorocha / README.md
Last active April 6, 2024 16:59
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@leesmith
leesmith / setup.md
Created May 16, 2012 00:27
Ruby on Rails development setup on Ubuntu 12.04 (vim, git, rbenv)

Ruby on Rails development setup on Ubuntu 12.04

System update

# change mirror to ubuntu.osuosl.org first
sudo apt-get update

Install common libraries

@ziadoz
ziadoz / awesome-php.md
Last active April 17, 2024 21:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.