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
| #!/bin/bash | |
| reset='\e[0m'; | |
| green='\e[1;32m'; | |
| red='\e[1;31m'; | |
| rake db:drop db:create | |
| ls -1 db/migrate | sort | cut -f 1 -d '_' | while read version; do | |
| printf "${version}" | |
| ERROR=$(((rake db:migrate:up VERSION=${version}; ) 1>/dev/null) 2>&1) | |
| if [ $? -eq 0 ]; then | |
| printf "\r${green}${version}${reset}\n" |
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
| remove_file "README.rdoc" | |
| create_file "README.md", "TODO" | |
| gem 'mysql2' | |
| gem 'devise' | |
| gem 'cancan' | |
| gem "slim-rails" |
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
| remove_file "README.rdoc" | |
| create_file "README.md", "TODO" | |
| gem 'devise' | |
| gem 'cancan' | |
| gem "slim-rails" | |
| gem_group :assets do | |
| gem 'anjlab-bootstrap-rails', '>= 2.3', :require => 'bootstrap-rails' |
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
| simulated_widths = (100 ... 1024).to_a.reverse | |
| puts "Maximizing the width" | |
| simulated_widths.each do |width| | |
| number_of_elements_per_row = (width/200.0).ceil | |
| element_width = (width/number_of_elements_per_row).floor #floor to get even pixel values | |
| puts " #{width}px: #{number_of_elements_per_row} elements with #{element_width}px" | |
| end | |
| puts "Minimizing the width" |
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
| # encoding: UTF-8 | |
| class CheckVerifiedStrategy < ::Devise::Strategies::Base | |
| def valid? | |
| params[:user] and params[:user][:email] | |
| end | |
| def authenticate! | |
| user = User.where(email: params[:user][:email]).first | |
| if user and not user.verified? | |
| fail!(I18n.t('profile.requested')) | |
| else |
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
| ruby -e "require 'time';puts ((Time.parse('Jun 11 11:50') - Time.now) / 60 / 60 / 24).round.to_s + ' days left'" |
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
| <html> | |
| <title>File API</title> | |
| <head> | |
| <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script> | |
| <script type="text/javascript"> | |
| $(document).ready(function(){ | |
| console.log("loaded"); | |
| var holder = document.getElementById('holder'), | |
| state = document.getElementById('status'); |
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
| Gem::Specification.new do |s| | |
| s.name = 'genetic_algorithm' | |
| s.version = '0.0.1' | |
| s.platform = Gem::Platform::RUBY | |
| s.author = 'Sebastian Geiger' | |
| s.email = 'sebastian.geiger@gmail.com' | |
| s.summary = 'A primitive and unfinished genetic algorithm' | |
| s.description = 'This algorithm will take a vector of a fixed length togther with a sum constraint and an executable. The executable must return the performance indicator, the vector should be consumed by the block in order to configure its operation. The performance measure is used to optimize the vector. This is work in progress!' | |
| s.files = ['genetic_algorithm.rb'] |
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
| import locale | |
| import nltk | |
| from nltk.corpus import wordnet as wn | |
| from nltk.tag.simplify import simplify_wsj_tag | |
| def main(): | |
| string = "I saw a man who is 98 years old and can still walk and tell jokes." | |
| tokens = nltk.word_tokenize(string) | |
| print nice_formatting(combinations_without_wordtype(tokens)) + " possible combinations when not taking wordtype into account" | |
| print nice_formatting(combinations_with_wordtype(tokens)) + " possible combinations when taking wordtype into account" |
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
| #include <iostream> | |
| #include <string.h> | |
| #include <boost/tr1/memory.hpp> | |
| class Image { | |
| public: | |
| Image(std::string className = "Image") | |
| : className_(className) | |
| {} |