├── CNAME ├── img ├── favicon.ico ├── google.png ├── twitter.png ├── facebook.png ├── bernie-sanders.jpg ├── bernie-sanders-og.jpg ├── bernie-sanders-favicon.pdn ├── bernie-sanders-favicon.png ├── bernie-sanders-original.jpg ├── billionaires.svg └── billionaires_white.svg ├── fonts ├── FreightSans Bold.ttf ├── FreightSans Book.ttf ├── FreightSans BoldSC.ttf ├── FreightSans Medium.ttf └── JubilatMedium-Roman.otf ├── shareables ├── isnt-he-a-socialist.pdn └── isnt-he-a-socialist.png ├── get-primary-stats.rb ├── LICENSE ├── index.html ├── js ├── scripts.js ├── faq.js ├── messages.js └── jquery-2.1.4.min.js ├── css └── styles.css ├── primary_stats.json └── messages.js /CNAME: -------------------------------------------------------------------------------- 1 | ilikeberniebut.com -------------------------------------------------------------------------------- /img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/img/favicon.ico -------------------------------------------------------------------------------- /img/google.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/img/google.png -------------------------------------------------------------------------------- /img/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/img/twitter.png -------------------------------------------------------------------------------- /img/facebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/img/facebook.png -------------------------------------------------------------------------------- /img/bernie-sanders.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/img/bernie-sanders.jpg -------------------------------------------------------------------------------- /img/bernie-sanders-og.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/img/bernie-sanders-og.jpg -------------------------------------------------------------------------------- /fonts/FreightSans Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/fonts/FreightSans Bold.ttf -------------------------------------------------------------------------------- /fonts/FreightSans Book.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/fonts/FreightSans Book.ttf -------------------------------------------------------------------------------- /fonts/FreightSans BoldSC.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/fonts/FreightSans BoldSC.ttf -------------------------------------------------------------------------------- /fonts/FreightSans Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/fonts/FreightSans Medium.ttf -------------------------------------------------------------------------------- /fonts/JubilatMedium-Roman.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/fonts/JubilatMedium-Roman.otf -------------------------------------------------------------------------------- /img/bernie-sanders-favicon.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/img/bernie-sanders-favicon.pdn -------------------------------------------------------------------------------- /img/bernie-sanders-favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/img/bernie-sanders-favicon.png -------------------------------------------------------------------------------- /img/bernie-sanders-original.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/img/bernie-sanders-original.jpg -------------------------------------------------------------------------------- /shareables/isnt-he-a-socialist.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/shareables/isnt-he-a-socialist.pdn -------------------------------------------------------------------------------- /shareables/isnt-he-a-socialist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacobnisnevich/i-like-bernie-but/HEAD/shareables/isnt-he-a-socialist.png -------------------------------------------------------------------------------- /get-primary-stats.rb: -------------------------------------------------------------------------------- 1 | require 'nokogiri' 2 | require 'open-uri' 3 | require 'json' 4 | 5 | page = Nokogiri::HTML(open('http://voteforbernie.org/')) 6 | states = page.css(".state") 7 | 8 | messages = {} 9 | 10 | states.each do |state| 11 | state_data = {} 12 | 13 | state_name = state.css(".state-title").text.strip 14 | 15 | state_type_match = state.css(".state-content").text.match(state_name + ' .* has (.*?) (primaries|caucuses)') 16 | state_data["openness"] = state_type_match[1] 17 | state_data["type"] = state_type_match[2] 18 | 19 | state_resources = state.css(".resources div") 20 | state_data["date"] = state_resources[0].text.match('(Primary|Caucus) On(.*)')[2] 21 | if !state_resources[1].nil? 22 | state_data["registrationDeadline"] = state_resources[1].text.match('Register By(.*)')[1] 23 | else 24 | state_data["registrationDeadline"] = nil 25 | end 26 | 27 | state_data["onlineAvailable"] = state.css(".extra").text.include? "Online Registration Available!" 28 | 29 | messages[state_name] = state_data 30 | end 31 | 32 | File.open("primary_stats.json", 'w') do |file| 33 | file.write(messages.to_json) 34 | end -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Jacob Nisnevich 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |