This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule HealthyskinWeb.SubscriptionController do | |
use HealthyskinWeb, :controller | |
def create(conn, %{"email" => email}) do | |
IO.inspect(email, label: "Email submitted") | |
send_resp(conn, 200, "") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule HealthyskinWeb.Router do | |
use HealthyskinWeb, :router | |
pipeline :api do | |
plug :accepts, ["json"] | |
end | |
scope "/api", HealthyskinWeb do | |
pipe_through :api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import axios from 'axios'; | |
import './App.css'; | |
function App() { | |
const [email, setEmail] = useState(''); | |
const [error, setError] = useState(''); | |
const [isSubmitted, setSubmitted] = useState(false); | |
const [isProcessing, setProcessing] = useState(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.App {margin:200px 0;text-align:center;font-size:16px;} | |
.App form input[type="email"] {font-size:16px;padding:7px 10px;border:1px solid #ccc;border-radius:6px;} | |
.App p.success {color:green;} | |
.App p.error {color:red;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Slugify do | |
@moduledoc """ | |
The main intent of this module is to be used in slug generation for URLs. | |
Supports russian transliteration. | |
""" | |
@char_mappings %{"а" => "a", "б" => "b", "в" => "v", "г" => "g", "д" => "d", "е" => "e", | |
"ё" => "e", "ж" => "j", "з" => "z", "и" => "i", "й" => "i", "к" => "k", "л" => "l", "м" => "m", | |
"н" => "n", "о" => "o", "п" => "p", "р" => "r", "с" => "s", "т" => "t", "у" => "y", "ф" => "f", | |
"х" => "h", "ц" => "ts", "ч" => "ch", "ш" => "sh", "щ" => "sch", "ъ" => "", "ы" => "y", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ScatterSwap do | |
@moduledoc """ | |
Usage: | |
Pass a number (as an integer) and random spin to the 'hash' function and it will return an obfuscated version of it. | |
ScatterSwap.hash(1, 0) #=> 4517239960 | |
ScatterSwap.hash(2, 0) #=> 7023641925 | |
ScatterSwap.hash(42, 0) #=> 2912536240 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In spec_helper: | |
# RSpec.configure do |config| | |
# ... | |
# config.include(MockGeocoder) | |
# end | |
# | |
# In your tests: | |
# it 'mock geocoding' do | |
# mock_geocoding! # You may pass additional params to override defaults (i.e. :coordinates => [10, 20]) | |
# address = Factory(:address) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* jQuery HideConfirmation Plugin | |
* version: 1.0 (27-JUL-2011) | |
* created by: PavelTyk https://github.com/PavelTyk | |
* | |
* This is a simple plugin to automatically hide confirmation fields if | |
* no changes made to observed field. | |
* | |
* Dual licensed under the MIT and GPL licenses: | |
* http://www.opensource.org/licenses/mit-license.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def logger | |
@logger_for_attachment_fu_rake_task ||= Logger.new STDOUT | |
end | |
def raise_with_logger(msg) | |
logger.error msg | |
raise msg | |
end | |
def obtain_class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In config/simple_navigation.rb | |
require 'simple_navigation/rails_controller_methods' | |
ActionController::Base.class_eval do | |
def self.disable_navigation_auto_highlighting(*args) | |
around_filter :temporary_disable_simple_navigation_auto_highlighting, *args | |
end | |
def temporary_disable_simple_navigation_auto_highlighting | |
auto_highlight = SimpleNavigation::Configuration.instance.auto_highlight |