Skip to content

Instantly share code, notes, and snippets.

View CalyCherkaoui's full-sized avatar
:octocat:
Looking for New Opportunities

Houda Cherkaoui CalyCherkaoui

:octocat:
Looking for New Opportunities
View GitHub Profile
@CalyCherkaoui
CalyCherkaoui / redisUseCases.md
Created January 7, 2023 18:00
Redis can be used in a variety of scenarios

redis

@CalyCherkaoui
CalyCherkaoui / gist:d9357f40cab7692976cacd624ec03702
Last active July 21, 2021 18:28
React Redux Capstone project videos
https://www.loom.com/share/c14c2822d71b4567a5015372f560c4cc
https://www.loom.com/share/10aa2e3607ff411e9f3ad9f41a7780c4
3rd part of the presentation with Explanations for Virtual DOM and Redux data flow
https://www.loom.com/share/3bc1dbcef303408a9f8616fc605e5604
@CalyCherkaoui
CalyCherkaoui / gh-pages-deploy.md
Created January 15, 2021 18:27 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

## How to hide API keys from github ##
1. If you have already pushed commits with sensitive data, follow this guide to remove the sensitive info while
retaining your commits: https://help.github.com/articles/remove-sensitive-data/
2. In the terminal, create a config.js file and open it up:
touch config.js
atom config.js
# In your test_helper.rb
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || retrieve_connection
end
end
@CalyCherkaoui
CalyCherkaoui / index.html.slim
Created October 6, 2020 00:37 — forked from ryenski/index.html.slim
Tabbed interface with Stimulus.js
div data-controller='tabs' data-tabs-index='1'
.tabs.is-boxed.is-marginless
ul
li data-target='tabs.tab'
a data={action: "tabs#change"} Tab 1
li data-target='tabs.tab'
a data={action: "tabs#change"} Tab 2
.tab.box data={target: 'tabs.tabPanel'} Tab panel 1
.tab.box data={target: 'tabs.tabPanel'} Tab panel 2
@CalyCherkaoui
CalyCherkaoui / console
Created September 25, 2020 22:29 — forked from zhuliangyu/console
rspec
rails g rspec:install
create a rspect for controller
rails g rspec:controller passwords
create a rspect for model
rails g rspec:model widget
rails g factory_girl:model Car name speed:integer
Rails 3: If you want to use the file db/seeds.rb to seed you test database before running your specs do this:
Create a file called spec.rake in lib/tasks/
In this file you stick:
task :spec => ["db:test:prepare", "db:seed"]
and that will do the trick
@CalyCherkaoui
CalyCherkaoui / testing_rails.rb
Last active September 14, 2020 21:26
Some usefull snippets for Rails
# How to create many instances for tests
context 'Friendship relations' do
# populating users for test
let (:params) { {name: 'usertest', email: '[email protected]', password: 'foobar', password_confirmation: 'foobar'} }
before(:each) do
User.new(params).save
User.new(params).save
User.new(params.merge(gravatar_url: 'mygravatar')).save
end