Skip to content

Instantly share code, notes, and snippets.

View roaldjap's full-sized avatar
:octocat:
Github is not my main version control ATM.

Jap roaldjap

:octocat:
Github is not my main version control ATM.
View GitHub Profile

Rails Application with Devise and Two-Factor Authentication

Prerequisites: Ruby, Rails, Active Record CRUD and Javascript

When you start learning web-development with rails, you start by understanding the fundamentals of an MVC Framework. Once through the basics, blog is the first application for most of us. But we evolve quickly into more complex applications, thanks to DHH and the Rails Community. Any application you build would require authentication and perhaps the ability for two-factor authentication for your users.

In this guide, we will start with a brand new rails application, will add devise and add two factor authentication to the application.

What will you learn:

@roaldjap
roaldjap / rails http status codes
Created June 9, 2021 04:48 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@roaldjap
roaldjap / capybara-cheat-sheet.rb
Last active March 24, 2021 00:55 — forked from zhengjia/capybara cheat sheet
Rspec / Capybara Cheatsheet
Circle Software Docs - Practices
https://docs.google.com/document/d/1bx0BgquO8ZBCpytc7IoY7lMv0b7gYpzo0SFOyyGCdFg/edit
# Navigating
visit('/projects')
visit(post_comments_path(post))
scroll_to(page.find(".settings-purchase-options"))
# Clicking links and buttons
@roaldjap
roaldjap / findkey.js
Created August 11, 2020 05:49 — forked from jboulhous/findkey.js
Find key by value, with underscore.js
function findKey(obj, value){
var key;
_.each(_.keys(obj), function(k){
var v = obj[k];
if (v === value){
key = k;
}
});
<!doctype html>
<html>
<head>
<title>This is the title of the webpage!</title>
</head>
<body>
<p id="integer-value" data-startDate="1/1/2020" >1203897</p>
<p>This is an example paragraph. Anything in the <strong>body</strong> tag will appear on the page, just like this <strong>p</strong> tag and its contents.</p>
</body>
</html>
@roaldjap
roaldjap / php-webscraping.md
Created November 22, 2016 12:34 — forked from anchetaWern/php-webscraping.md
web scraping in php

Have you ever wanted to get a specific data from another website but there's no API available for it? That's where Web Scraping comes in, if the data is not made available by the website we can just scrape it from the website itself.

But before we dive in let us first define what web scraping is. According to Wikipedia:

{% blockquote %} Web scraping (web harvesting or web data extraction) is a computer software technique of extracting information from websites. Usually, such software programs simulate human exploration of the World Wide Web by either implementing low-level Hypertext Transfer Protocol (HTTP), or embedding a fully-fledged web browser, such as Internet Explorer or Mozilla Firefox. {% endblockquote %}

@roaldjap
roaldjap / sets.json
Last active September 26, 2016 14:33
Guideguide Defaults
{"Default":{"name":"Default","sets":{"cbc5507de150aa324c323dea5246f8a7f2dd3618":{"name":"Bootstrap 1170","string":"$v = | 65px | 15px | 15px |\n$vC = | 65px |\n200px | 15px | 15px | $v*11 | $vC | 15px | 15px | 200px ( vlp, | ~ )","id":"cbc5507de150aa324c323dea5246f8a7f2dd3618"},"6a188b701a91b394b3c1608844c33ad416d21f25":{"name":"Bootstrap 970","string":"$v = | 48px | 15px | 15px |\n$vC = | 48px |\n200px | 17px | 15px | $v*11 | $vC | 15px | 17px | 200px ( vlp, | ~ )","id":"6a188b701a91b394b3c1608844c33ad416d21f25"},"fbfee59f64b58b94682597dc8e6cf67ba84a65af":{"name":"Bootstrap 750","string":"$v = | 30px | 15px | 15px |\n$vC = | 30px |\n200px | 15px | 15px | $v*11 | $vC | 15px | 15px | 200px ( vlp, | ~ )","id":"fbfee59f64b58b94682597dc8e6cf67ba84a65af"}}}}
@roaldjap
roaldjap / fix-homebrew-npm.md
Last active August 29, 2015 14:27 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

If you just want to fix the issue quickly, scroll down to the "solution" section below.

Explanation of the issue

If you're a Homebrew user and you installed node via Homebrew, there is a major philosophical issue with the way Homebrew and NPM work together. If you install node with Homebrew and then try to do npm update npm -g, you may see an error like this:

$ npm update npm -g
@roaldjap
roaldjap / .gitignore
Last active August 29, 2015 14:22 — forked from octocat/.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@roaldjap
roaldjap / 960gs.jsx
Created August 12, 2013 09:33 — forked from cbguder/960gs.jsx
/*
* 960gs ExtendScript for Adobe Photoshop CS5
* Copyright (c) 2010 Can Berk Güder
*/
#target photoshop
var doc;
var w = new Window(
"dialog {\