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
module FilmSearch | |
extend ActiveSupport::Concern | |
included do | |
include Elasticsearch::Model | |
include Elasticsearch::Model::Callbacks | |
mapping do | |
indexes "title", type: 'string', analyzer: 'snowball' | |
indexes "signing.starts_at", type: 'date', format: 'basic_date' |
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
/* | |
By Oto Brglez - <otobrglez@gmail.com> | |
What is FizzBuzz? http://en.wikipedia.org/wiki/Fizz_buzz | |
Requirements: Mono & Make | |
Compile with: make | |
Run with: mono ./FizzBuzz.exe | |
*/ | |
using System; |
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
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
public class FizzBuzz { | |
public static IEnumerable<String> FizzBuzzMe(int to){ | |
return Enumerable.Range(1, to).Select(j => | |
j % 3 == 0 && j % 5 == 0 ? "Fizz Buzz" : ( | |
j % 3 == 0 ? "Fizz" : ( | |
j % 5 == 0 ? "Buzz" : j.ToString() |
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
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
public class FizzBuzz { | |
public static List<String> FizzBuzzMe2(int to){ | |
List<String> list = new List<String>(); | |
int i = 1; | |
for(; i<=to; list.Add(i.ToString()), i++); |
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
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
public class FizzBuzz { | |
public static List<String> FizzBuzzMe3(int to){ | |
return Enumerable.Range(1, to).Select(i => | |
new Dictionary<int, String>(){ | |
{1, i.ToString()}, {5, "Buzz"}, {3, "Fizz"}, {3*5, "Fizz Buzz"} | |
}.Last(a => i % a.Key == 0).Value |
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
object Application { | |
def fizzBuzzMega(e: Int): List[String] = { | |
var big = (1 to e).toList.map (i => i.toString) | |
val m = List( | |
(3, ((1 to e).toList zip List.range(0, e+3, 3)).drop(1).map (_._2)), | |
(5, ((1 to e).toList zip List.range(0, e+5, 5)).drop(1).map (_._2)), | |
(3*5, ((1 to e).toList zip List.range(0, e+3*5, 15)).drop(1).map (_._2)) | |
).map(p => | |
p._2.map (n => | |
big = big.updated(n-1, |
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
# Install https://github.com/github/hub | |
# Add alias to your ~/.bash_profile (or somewhere alike) | |
alias ci-open='open `hub ci-status -v | grep -oE "[^\ ]+$"`' | |
Use it with your normal workflow... | |
git push ... | |
ci-open | |
# and see your CI pass. ;) |
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
- I18n.available_locales.each_with_index do |locale,i| | |
- ulocale = locale.to_s.underscore | |
- show_expanded = [:'en-US', I18n.locale].include?(locale) | |
.panel.panel-default{id: ulocale} | |
%a.panel-default{"data-toggle" => "collapse", "data-parent" => "##{ulocale}", "href" => "#panel-#{ulocale}"} | |
.panel-heading | |
.panel-title= CONFIG[:display_locales][locale] |
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
# Regular expression that | |
# 1. Finds host name | |
# 2. Finds path name | |
# 3. Ignores first optional numeric 'cache-buster' parameter | |
xp = %r{^http:\/\/([a-z0-9\.]+)\/([a-z_]+)\/(.*?)(?:\?|$)} | |
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
/* | |
When tinymce f* u over! | |
*/ | |
jQuery.rails.href = function(element) { | |
var href = element.attr('href'); | |
if(typeof(href) == "string") { | |
return href; | |
} |