Skip to content

Instantly share code, notes, and snippets.

View evdokimovm's full-sized avatar

Mikhail Evdokimov evdokimovm

View GitHub Profile
@evdokimovm
evdokimovm / histogram.rb
Created January 24, 2016 00:45
Simple Ruby Histogram
puts "Text please: "
text = gets.chomp
words = text.split(" ")
frequencies = Hash.new(0)
words.each { |word| frequencies[word] += 1 }
frequencies = frequencies.sort_by {|a, b| b }
frequencies.reverse!
@evdokimovm
evdokimovm / RubySimpleParseJSON.rb
Created January 6, 2016 01:19
Ruby Simple Parse JSON file
require 'json'
pets = File.open("file.json", "r")
doc = ""
pets.each do |line|
doc << line
end
pets.close
@evdokimovm
evdokimovm / index.html
Created December 12, 2015 14:38
Weather. Current Temp. Celsius and Fahrenheit. JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Weather</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="main.js"></script>
</head>
<body>
@evdokimovm
evdokimovm / File Icons.sublime-settings
Last active January 31, 2017 18:30
My Sublime Text 3 User Settings File
{
"force_override": true,
"size": 11
}
@evdokimovm
evdokimovm / SaveScrollPosition.js
Created October 27, 2015 08:05
Save Scroll Position
var $window = $(window)
/* Restore scroll position */
window.scroll(0, localStorage.getItem('scrollPosition')|0)
/* Save scroll position */
$window.scroll(function () {
localStorage.setItem('scrollPosition', $window.scrollTop())
})