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
mount | |
sudo umount /dev/sdX | |
mkfs.msdos -F 32 /dev/sdX | |
#remount device |
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
#prerequisites | |
#sudo apt-get install libmagic-dev | |
#https://github.com/blackwinter/ruby-filemagic | |
require 'filemagic' | |
puts FileMagic.new(FileMagic::MAGIC_MIME).file(__FILE__) | |
# => text/x-ruby; charset=us-ascii | |
#OR |
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
#config/initializers/pluralization.rb: | |
require "i18n/backend/pluralization" | |
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization) | |
#config/locales/plurals.rb: | |
{:ru => | |
{ :i18n => |
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
#config/initializers/will_paginate_array_fix.rb | |
require 'will_paginate/array' |
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 profits=2489.8237 | |
profits.toFixed(3) //returns 2489.824 (round up) | |
profits.toFixed(2) //returns 2489.82 | |
profits.toFixed(7) //returns 2489.8237000 (padding) |
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
Model.where({}) |
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
(Time.now..Time.now+4).cover?(Time.now) => true |
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
if $('#search') | |
text = $('#search').val() | |
$('#search').keyup( -> | |
if $('#search').val() != text | |
console.log 'changed' | |
) |
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
// use a closer ancestor that is NOT destroyed. Best option if you can | |
$('#someAncestor').on('click', '.something', function() { /* ... */ }); |
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
//check a remainder when dividing by 1: | |
function isInt(n) { | |
return n % 1 === 0; | |
} | |
//If you don't know that the argument is a number- | |
function isInt(n) { | |
return !isNaN(n) && n % 1 == 0; | |
} |
OlderNewer