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
#!/usr/bin/env ruby | |
# If you get "unknown OID 705: failed to recognize type of '<field>'. It will be treated as String." | |
# it probably means that type of column could not be identified when retriving records | |
# Example | |
User.where("'something' as something") | |
# Will results in unknown OID. However doing this: |
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
g++ -O3 -fPIC -fomit-frame-pointer -ffast-math -I./src -I./bindings/java/headers -I./bindings/java/headers/linux -c ./bindings/java/headers/sl_lemmatizer_java.cpp -o ./src/sl_java_headers.o | |
In file included from ./bindings/java/headers/sl_lemmatizer_java.cpp:23: | |
./src/RdrLemmatizer.h:122:21: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings] | |
char *acParSufx = "", char *acParDev = "", char cNewChar=NULL) const; | |
^ | |
./src/RdrLemmatizer.h:122:42: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings] | |
char *acParSufx = "", char *acParDev = "", char cNewChar=NULL) const; | |
^ | |
./src/RdrLemmatizer.h:122:60: warning: implicit conversion of NULL constant to 'char' [-Wnull-conversion] | |
char *acParSufx = "", char *acParDev = "", char cNewChar=NULL) const; |
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
import pprint | |
# Something like this: | |
pprint.pprint some_object.__dict__ |
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
import rollbar | |
import logging | |
# Needed if you use rollbar.report_exc_info | |
import sys | |
class RollbarLogObserver(object): | |
def __init__(self, rollbar_access_token, env="development", level=logging.INFO): | |
self.level = level | |
rollbar.init(rollbar_access_token, env) |
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; | |
} |
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
- 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
# 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
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
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 |