Skip to content

Instantly share code, notes, and snippets.

@jtsagata
jtsagata / I18n.rb
Created July 16, 2012 03:02
Missing translators logger and visualizer for I18n
I18n::Backend::Simple.include(I18n::Backend::Metadata)
# This will work with <%= t %> , not with <%= I18n.t %>
module ActionView
module Helpers
module TranslationHelper
alias_method :translate_basic, :translate
mattr_accessor :i18n_logger
def translate(key, options = {})
@jtsagata
jtsagata / count_trigger.sql
Created August 13, 2012 00:34
Postgres count problem
--
-- http://wiki.postgresql.org/wiki/Slow_Counting
-- http://www.varlena.com/GeneralBits/49.php
-- http://www.varlena.com/GeneralBits/120.php
-- http://omega-glory.net/2007/12/12/postgresql-count-workaround/
--
-- While waiting for 9.2
-- http://rhaas.blogspot.gr/2011/10/index-only-scans-weve-got-em.html
--
@jtsagata
jtsagata / hosts.txt
Created November 2, 2012 12:31
/etc/hosts
# Bad Advertisment
0.0.0.0 www.internetmoneymethods.com
0.0.0.0 gr.bongacams.com
0.0.0.0 pubads.g.doubleclick.net
0.0.0.0 ad.doubleclick.net
0.0.0.0 ad24.gr
0.0.0.0 www.bwin.com
# Ad server list for use with hosts files to block ads
#
@jtsagata
jtsagata / fast_compile.sh
Last active December 23, 2015 07:49
Continous compile a project using ccach, cmake, inotify-tools and ninja
#!/bin/bash
# sudo apt-get install inotify-tools ninja-build cmake
CURPATH=`pwd`
#Sounds to play.
OKSOUND='/usr/share/sounds/pop.wav'
ERRSOUND='/usr/share/sounds/KDE-K3B-Finish-Error.ogg'
inotifywait -mqr --timefmt '%d/%m/%y %H:%M' --format '%T %w %f %e' \
#include "terrain.hpp"
TerrainEngine::TerrainEngine( Ogre::String seed, Ogre::Root *root, Ogre::SceneManager *scenemgr, Ogre::Camera *cam, Ogre::Light* light, Ogre::String file_prefix, Ogre::String file_suffix )
: mRoot(root)
, mTerrainGroup(0)
, mTerrainPos(1000,0,5000)
, mLayerEdit(1)
, mTerrainsImported(false)
, mSceneMgr(scenemgr)
@jtsagata
jtsagata / simgleton.cpp
Created December 24, 2013 11:51
Singleton notes
// http://en.wikipedia.org/wiki/Double-checked_locking
Singleton& Singleton::getInstance() {
static Singleton instance;
return instance;
}
// More info
// http://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/
@jtsagata
jtsagata / install_sublime_text_handler.sh
Last active August 29, 2015 13:59
Sublime Text 3, livereload, railsPanel, better_errors, linux
#!/bin/bash
echo "Installing Sublime text handler"
sudo cp sublime-handler /usr/local/bin
sudo cp sublime-handler.desktop /usr/share/applications/
echo "Updating desktop database"
sudo update-desktop-database
cat <<THE_END
Not done yet!
#!/bin/bash
#information
echo "
Popcorn-Time Beta 2 for Ubuntu-Linux
------------------------------------
WARNING: Popcorn Time streams movies from Torrents. Downloading copyrighted material may be illegal in your country. Use at your own risk.
"
#verify awareness
@jtsagata
jtsagata / ci-tool.py
Last active August 29, 2015 14:08
Poor mens CI. Continious Integration with Zeus, RSpec, tmux/tmuxinator like clone. Autotest and autoreload functionality (Work in progress)
#!/usr/bin/env python
# filename <app>/ci_tool
# Zeus CI IDE
# Created by talos aka Giannis Tsagatakis
# --color
# --require spec_helper
# --format documentation
# --format html -o "tmp/rspec.html"
@jtsagata
jtsagata / Readme
Created December 28, 2014 10:09
Add column definitions to a migration
rails g model user name:string avatar:attached
create_table :users do |t|
t.string :name
t.string :avatar_identifier
t.string :avatar_extension
t.integer :avatar_size
end
For more info look