Skip to content

Instantly share code, notes, and snippets.

View egze's full-sized avatar

Aleksandr Lossenko egze

View GitHub Profile
<a href="http://www.getfirefox.com" target="_blank" id="getfirefox">Please use Mozilla Firefox</a>
<style type="text/css">
#getfirefox {
width:172px;
height:176px;
position: absolute;
float: right;
right: 0;
cursor:pointer;
#!/usr/bin/env ruby
print '<%= _("' + STDIN.read + ' ") %>'
<div class="cligs-widget" style="width: 190px; margin-top: 10px; margin-bottom: 10px;">
<script type="text/javascript" src="http://cligs.ru/widgets/elife.js"></script>
<a href="http://cligs.ee?utm_source=elife&utm_medium=cligs_link" style="color: rgb(51, 153, 204); font-weight: bold;" title="Üritused ja kontserdid Tallinnas ja Eestis. Fotod üritustest ja palju muud">Другие тусовки на Cligs.ee</a>
</div>
@egze
egze / Gemfile
Created January 6, 2011 13:05 — forked from smichaelis/Gemfile
# Critical default settings:
disable_system_gems
disable_rubygems
bundle_path '.gems/bundler_gems'
# List gems to bundle here:
gem 'rails_dm_datastore'
gem 'rails', "2.3.5"
# Needed for Devise-Plugin
@egze
egze / README.rdoc
Created January 6, 2011 14:07 — forked from woodie/README.rdoc

Rails 2.3.10 on App Engine (DataMapper)

Do not use rvm (or install and run from JRuby). The google-appengine gem must install into your system MRI. The appengine-sdk gem includes a complete Java app server. We bootstrap Java from MRI, then your app runs inside a servlet container (with access to all the APIs) using the version of JRuby installed into each app.

We assumed Rails 2 would never work without rubygems, and we committed to gem bunlder for JRuby on App Engine, so we were waiting for Rails 3. Fortunately, Takeru Sasaki was able to patch the Rails 2.3.x calls to rubygems, and now we have it working. Rails 2.3.x currently spins up several seconds faster than Rails 3, and just a few seconds behind Sinatra.

See the TInyDS version also: gist.github.com/gists/269075

Install the Development Environment

@egze
egze / gist:2263793
Created March 31, 2012 12:51
Extending Tire for fuzzy search and other useful methods
module Tire
module Search
class Query
def fuzzy(match={})
@value = { :fuzzy => match }
@value
end
def text(match={})
@egze
egze / gist:3287333
Created August 7, 2012 17:06
TextMate 2 .tm_properties

This is all based on the [alpha release][1].

Properties

From the built-in help system:

For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).

These are simple setting = value listings where the value is a format string in which other variables can be referenced.

@egze
egze / after_commit_patch.rb
Created August 21, 2012 18:22 — forked from gnufied/after_commit_patch.rb
after_commit_patch.rb
#WARNING do not load this file in environments other than test
module AfterCommitPatch
def transaction(options = {})
rolled_back = false
return_value = nil
begin
return_value = super
rescue ActiveRecord::Rollback => e
puts e.message
puts e.backtrace
@egze
egze / gist:4032292
Created November 7, 2012 15:35
proxy script
function FindProxyForURL(url, host) {
var usa = ['hulu.com', 'netflix.com', 'abc.go.com', 'pandora.com', 'aetv.com', 'adultswim.com', 'bravotv.com', 'rdio.com'];
var direct = ['ll.a.hulu.com', 'ads.hulu.com', 'ak.rdio.com', 'stats.pandora.com', 'pubsub1.rdio.com'];
for(var i=0;i<direct.length;i++){
if(host.indexOf(direct[i]) > -1){
return 'DIRECT';
}
}
if(host.match(/audio.*\.pandora\.com/) || host.match(/const.*\.pandora\.com/)){
return 'DIRECT';
@egze
egze / gist:6855875
Last active December 24, 2015 20:09
Query
"query" => {
"filtered" => {
"query" => {
"match_all" => {}
},
"filter" => {
"bool" => {
"must" => [
{
"terms" => {