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
class FlattenTest | |
def self.custom_flatten(array, result = []) | |
array.each do |item| | |
if item.is_a? Array | |
custom_flatten(item, result) | |
else | |
result << item | |
end | |
end | |
result |
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
var triggered = false; | |
(function loop() { | |
var now = new Date(); | |
// here the method will be triggered at 20:28, you can change them as per your need | |
if (!triggered && now.getHours() === 20 && now.getMinutes() === 28) { | |
method(); | |
triggered = true; | |
} | |
console.log('Now: ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds()); |
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
##Create a migration | |
### rails g migration make_unicode_friendly | |
class MakeUnicodeFriendly < ActiveRecord::Migration | |
def change | |
alter_database_and_tables_charsets "utf8", "utf8_general_ci" | |
end | |
private | |
def alter_database_and_tables_charsets charset = default_charset, collation = default_collation |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>demo</title> | |
<script src="http://code.jquery.com/jquery-1.10.0.min.js"> </script> | |
<style type="text/css"> | |
#progressBar { | |
width: 400px; | |
height: 22px; |
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
<!-- This section is important as it redirect to editor mode and handle form submition--> | |
<script type="text/javascript"> | |
<% if rich_text_enabled && params[:rich_text_enabled].nil? %> | |
location.href = "<%= "/editor" + request.path + "?rich_text_enabled=1"%>" | |
<% end %> | |
jQuery(window).on('mercury:ready', function () { | |
$('#how_to_content_submit').on('click', function () { |