# in routes.rb
Rails.application.routes.draw do
constraints subdomain: /(subdomain1|subdomain2|subdomain_n)/ do
constraints subdomain: /^subdomain1/ do
root to: "subdomain1/homes#show", as: :subdomain1_root
This file contains hidden or 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
| /* | |
| All docs get from | |
| Adjust: | |
| https://github.com/adjust/unity_sdk/blob/master/doc/english/sdk-to-sdk/ironsource.md | |
| Ironsource push Rev | |
| https://developers.is.com/ironsource-mobile/unity/ad-revenue-measurement-integration/#step-1 | |
| Note: Không push rev ở event onImpressionDataSuccessEvent mà push rev ở event onImpressionDataReadyEvent | |
| */ |
This file contains hidden or 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
| /* | |
| * Rotates an object towards the currently active camera | |
| * | |
| * 1. Attach CameraBillboard component to a canvas or a game object | |
| * 2. Specify the offset and you're done | |
| * | |
| **/ | |
| using UnityEngine; |
This file contains hidden or 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
| using UnityEngine; | |
| using System.Collections; | |
| public static class Vibration | |
| { | |
| #if UNITY_ANDROID && !UNITY_EDITOR | |
| public static AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); | |
| public static AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity"); | |
| public static AndroidJavaObject vibrator = currentActivity.Call<AndroidJavaObject>("getSystemService", "vibrator"); |
This file contains hidden or 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
| /* | |
| Before serialize data must update element of instance CKEDITOR | |
| */ | |
| $(function() { | |
| $("#form-submit-ajax-has-multi-image").on("submit", function(e) { | |
| for (instance in CKEDITOR.instances ) { | |
| CKEDITOR.instances[instance].updateElement(); | |
| } | |
| e.preventDefault(); |
SELECT IF(A IS NULL, B, A) AS AB from table_name order AB ASCSELECT IFNULL(A,B) AS AB from table_name order AB ASC
This file contains hidden or 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
| <%= javascript_include_tag Ckeditor.cdn_url %> | |
| phải ở trước html content để load ckeditor trước | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>DemoCkeditor</title> | |
| <meta name="csrf-param" content="authenticity_token" /> | |
| <meta name="csrf-token" content="05DsTmL/Ex9rB0qdNh/D6ArOrdNb/ZyoEMj84Mkfsk48JG2QzhK6Ytd/se94FsEsQfYozAwiyvBr5cEXa0pEXw==" /> |
This file contains hidden or 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
| sudo apt-get install zsh | |
| sudo apt-get install git-core | |
| Getting zsh to work in ubuntu is weird, since sh does not understand the source command. So, you do this to install zsh | |
| wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh | |
| and then you change your shell to zsh | |
| chsh -s `which zsh` | |
| and then restart |
This file contains hidden or 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
| class ValidDateValidator < ActiveModel::EachValidator | |
| # format dd/mm/yyyy | |
| DATE_FORMAT_REGEX = /^\s*(3[01]|[12][0-9]|0?[1-9])\/(1[012]|0?[1-9])\/((?:19|20)\d{2})\s*$/ | |
| # format yyyy/mm/dd | |
| # DATE_FORMAT_REGEX = /\A[0-9]{4}(\/|\-)(0[1-9]|1[0-2])(\/|\-)(0[1-9]|[1-2][0-9]|3[0-1])\z/ | |
| def validate_each record, attribute, _value | |
| records = if record.is_a?(ActiveRecord::Base) | |
| record.attributes_before_type_cast | |
| else | |
| record.as_json |
This file contains hidden or 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
| # add config 30 day so logout | |
| config.timeout_in = 30.days |
NewerOlder