Skip to content

Instantly share code, notes, and snippets.

View Fire-Dragon-DoL's full-sized avatar

Francesco Belladonna Fire-Dragon-DoL

View GitHub Profile
@Fire-Dragon-DoL
Fire-Dragon-DoL / stock photos.md
Created January 29, 2014 00:44
Stock photos websites from various newsletters, use them for your website!
tile init nooverrides
set %grid_size 0
sub scangrid
for %x -20 20
{
for %y -20 20
{
set %posX #charposx + %x
set %posY #charposy + %y
@echo off
echo Configuring MESA environment variables for Dota 2.
echo Credits http://puppet-master.net by Nicolas.Kirsch
call "..\..\config\mesa_check_env.bat"
SET SOURCE_BIN_PATH=%STEAMDIR%\steamapps\common\dota 2 beta\bin
SET GAME_PROJECT=%STEAMDIR%\steamapps\common\Dota 2 beta\dota
SET GAME_PROJECT_SRC=%MESADIR%\projects\Dota_2_src
SET GAME_PROJECT_NAME="dota"
@echo off
echo Configuring MESA environment variables for Dota 2.
echo Credits http://puppet-master.net by Nicolas.Kirsch
call "..\..\config\mesa_check_env.bat"
SET SOURCE_BIN_PATH=%STEAMDIR%\steamapps\common\dota 2 beta\bin
SET GAME_PROJECT=%STEAMDIR%\steamapps\common\Dota 2 beta\dota2
SET GAME_PROJECT_SRC=%MESADIR%\projects\Dota_2
SET GAME_PROJECT_NAME="Dota 2"
@Fire-Dragon-DoL
Fire-Dragon-DoL / arel.rb
Created December 4, 2013 11:15
Very weird arel constructs
# FIXME: Impossible to store the joined table in memory
def self.all_diseases_for_cat(cat)
cat_diseases = self.arel_table
diseases = Disease.arel_table
# .joins("RIGHT OUTER JOIN #{ Disease.table_name }
# ON #{ self.table_name }.#{ cat_diseases[:disease_id].name }
# = #{ Disease.table_name }.#{ diseases[:id].name }")
# RightOuterJoin created by me because I was bored
@Fire-Dragon-DoL
Fire-Dragon-DoL / users_controller.rb
Created December 4, 2013 10:14
Easy way to handle empty passwords in devise
# Never trust parameters from the scary internet, only allow the white list through.
def user_params
real_params = params.require(:user).permit(:email, :password, :password_confirmation, :role, :note)
if real_params[:password].blank?
real_params.delete(:password)
real_params.delete(:password_confirmation)
end
real_params
end
@Fire-Dragon-DoL
Fire-Dragon-DoL / gist:7569570
Created November 20, 2013 19:36
The truth about Final Fantasy XIV Summoner
Personally i feel the "summoner" doesn't play like a summoner at all. Primary job is applying dots, and the pet is just a ranged dot, or a melee dot with the option of a melee tanky dot.
It may just be my expectations were in the wrong, but i was completely hoping for a Yuna-esque summoner where my action bar was filled with pet commands and abilities where a good summoner could do their role while keeping both of them out of aoes.
As it is right now 90% of the time the pet dies you(me) don't notice it until you try and fire off enkindle or the other two generic abilities, a complete failure of a summoner class imho. At this point i wouldn't mind if they just gutted summons and made them fire and forget abilities like the versions from FF3-FF9 were.
@Fire-Dragon-DoL
Fire-Dragon-DoL / users_controller.rb
Created November 20, 2013 05:03
Rails scaffold
class UsersController < AdminController
before_action :set_user, only: [:show, :edit, :update, :destroy]
# GET /users
# GET /users.json
def index
@users = User.all
end
# GET /users/1
@Fire-Dragon-DoL
Fire-Dragon-DoL / dummies_controller_spec.rb
Created November 20, 2013 00:46
Testing controller destroy action without using change on :count
it "DELETE #destroy" do
dummy = FactoryGirl.create(:dummy)
delete :show, id: dummy.id
dummy.reload
dummy.persisted?.should be_false
end
@Fire-Dragon-DoL
Fire-Dragon-DoL / Bigger test suite is better
Created November 19, 2013 02:13
Bigger test suite is better
(03:10:14) Francesco Belladonna: uhm
(03:10:20) Francesco Belladonna: my testsuite is bigger than my code...
(03:10:24) Francesco Belladonna: there is something wrong with this
(03:11:30) Preston St. Pierre: no, it's totally right
(03:11:35) Francesco Belladonna: mh
(03:11:39) Preston St. Pierre: the testsuite is there to protect your code, so it has to be slightly bigger
(03:11:40) Francesco Belladonna: I still feel bad
(03:11:41) Preston St. Pierre: think about it
(03:11:46) Preston St. Pierre: a condom has to be slightly bigger than your penis