Skip to content

Instantly share code, notes, and snippets.

View alexbevi's full-sized avatar
🙀

Alex Bevilacqua alexbevi

🙀
View GitHub Profile
class Square: NamedShape {
var sideLength: Double
init(sideLength: Double, name: String) {
self.sideLength = sideLength
super.init(name: name)
numberOfSides = 4
}
func area() -> Double {
@alexbevi
alexbevi / development.log
Created March 24, 2014 17:21
Rails log with a long-running mongoid request that was killed with CTRL+C
Started GET "/users/5323168a616c65771a030000/edit" for 127.0.0.1 at 2014-03-24 13:01:53 -0400
Processing by UsersController#edit as HTML
Parameters: {"id"=>"5323168a616c65771a030000"}
MOPED: 1.1.1.1:27017 COMMAND database=admin command={:ismaster=>1} runtime: 36.5997ms
MOPED: 1.1.1.1:27017 QUERY database=phoenix collection=users selector={"$query"=>{"_id"=>BSON::ObjectId('53207289616c652137000000')}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil fields=nil runtime: 38.2057ms
MOPED: 1.1.1.1:27017 COMMAND database=phoenix command={:count=>"roles", :query=>{"$and"=>[{"_id"=>{"$in"=>[BSON::ObjectId('53207289616c652137010000'), BSON::ObjectId('53207293616c652137020000')]}}], "$or"=>[{"name"=>"super_user", "resource_type"=>nil, "resource_id"=>nil}]}} runtime: 28.6933ms
MOPED: 1.1.1.1:27017 QUERY database=phoenix collection=users selector={"_id"=>BSON::ObjectId('5323168a616c65771a030000')} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 24.3522ms
MOPED:
# Allows you to build a Hash in a fashion very similar to Builder. Example:
# Fork of https://gist.github.com/360506 by BrentD with some enhancements
#
# HashBuilder.build! do |h|
# h.name "Nilesh"
# h.skill "Ruby"
# h.skill "Rails" # multiple calls of the same method will collect the values in an array
# h.location "Udaipur, India" do # If a block is given, first argument will be set as value for :name
# h.location do
# h.longitude 24.57
@alexbevi
alexbevi / redmine_view_hooks.md
Last active November 1, 2021 10:09
A list of the view hooks that are registered in Redmine

Redmine View Hooks

The following is a list of the registered view hooks available in Redmine, as of version 2.3.3.

These have been listed in the form of

:name_of_hook
path/to/file: { :param_1, :param_2, ... :param_n}
@alexbevi
alexbevi / dfs-activity-report.sql
Created January 16, 2013 17:42
DFS Activity Report Lists owners/portals/projects based on their status and outputs the result directly
/*
DFS Activity Report
Lists owners/portals/projects based on their status and outputs the result directly
----
Copyright (C) 2013 Astley Gilbert Limited
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
/home/maximus/workspaces/cpp/scummvm/engines/tucker/detection.cpp
{ "tucker", "Bud Tucker in Double Trouble" },
/home/maximus/workspaces/cpp/scummvm/engines/uplink/detection.cpp
{"uplink", "Uplink: Hacker Elite"},
/home/maximus/workspaces/cpp/scummvm/engines/parallaction/detection.cpp
{"parallaction", "Parallaction engine game"},
{"nippon", "Nippon Safes Inc."},
{"bra", "The Big Red Adventure"},
@alexbevi
alexbevi / migrator
Created October 17, 2012 19:29 — forked from avsej/migrator
script/migrator for easier navigation of migrations
#!/usr/bin/env ruby
# Simple migration navigator for terminal.
#
# Install
# 1) Throw this code into script/migrator
# 2) chmod +x script/migrator
#
# Alternative install
# 1) Put this script into your executable path (e.g. ~/bin)
@alexbevi
alexbevi / global-search.patch
Created September 23, 2012 21:15
Redmine + Knowledgebase Patches for Global Search (proposed)
diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb
index 6bae37b..8057da6 100644
--- a/app/controllers/articles_controller.rb
+++ b/app/controllers/articles_controller.rb
@@ -83,7 +83,7 @@ class ArticlesController < KnowledgebaseController
end
def tagged
- @tag = params[:id]
+ @tag = params[:article_id] || params[:id]
@alexbevi
alexbevi / install_mongodb.sh
Created August 29, 2012 17:44
Automate installation of mongodb
#!/bin/bash
PKG=mongodb-linux-x86_64-2.2.0
URL=http://fastdl.mongodb.org/linux
if [ -f /etc/init.d/mongod ]
then
echo "mongod already installed ... stopping"
sudo service mongod stop
else
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <[email protected]>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.