Skip to content

Instantly share code, notes, and snippets.

View petros's full-sized avatar
👾
Making games

Petros Amoiridis petros

👾
Making games
View GitHub Profile
class ApplicationController < ActionController::Base
include SessionAuthentication
# ...
end

Keybase proof

I hereby claim:

  • I am petros on github.
  • I am petros (https://keybase.io/petros) on keybase.
  • I have a public key whose fingerprint is 0258 A4D8 FBE1 6C8A 1072 1C17 79CC 4830 0A0D 3529

To claim this, I am signing this object:

@petros
petros / Sample.md
Created April 7, 2014 07:49
Escaping jekyll code in jekyll
<li>
  <span>{{ post.date | date_to_string }}</span> &raquo;
    {% if post.external-url %}
      <a href="{{ post.external-url }}">{% if site.titlecase %}{{ post.title | titlecase }}{% else %}{{ post.title }}{% endif %}</a> · <a class="metaperma" href="{{ root_url }}{{ post.url }}">&#8984;</a> <br />
    {% else %} <!-- normal posts -->
      <a href="{{ post.url }}"> {{ post.title }}</a>
      <!-- {{ post.excerpt }} -->
    {% endif %}
@petros
petros / List-ForEach-method-instead-of-foreach.cs
Created June 12, 2009 13:50
Use List(T) ForEach method instead of foreach
//Use List(T) ForEach method
myList.ForEach(s => Console.WriteLine(s.ToString()));
//instead of:
foreach(var s in myList)
{
Console.WriteLine(s.ToString());
}
@petros
petros / CCNetConfigPart.xml
Created June 15, 2009 16:52
CC.NET Version control related settings
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<project name="MyProject" queue="Q1" queuePriority="1">
<modificationDelaySeconds>0</modificationDelaySeconds>
<maxSourceControlRetries>15</maxSourceControlRetries>
<stopProjectOnReachingMaxSourceControlRetries>true</stopProjectOnReachingMaxSourceControlRetries>
<sourceControlErrorHandling>ReportOnRetryAmount</sourceControlErrorHandling>
@petros
petros / HelloWorld.rb
Created June 15, 2009 17:16
Hello World in Ruby
puts "Hello world"
@petros
petros / gist:130224
Created June 15, 2009 17:18
Hello world in Flaming Thunder
Write "Hello world".
@petros
petros / RestoreMSSQLDbWithANewName.sql
Created June 17, 2009 09:25
Restore an MSSQL backup to a different database name
RESTORE DATABASE MyNewDB
FROM DISK = 'D:\MyDB.bak'
WITH
MOVE 'MyDB_Data' TO 'C:\MSSQL\Data\MyNewDB_Data.MDF',
MOVE 'MyDB_Log' TO 'C:\MSSQL\Data\MyNewDB_Log.LDF',
REPLACE
GO
if params[:category] != nil
@category = params[:category]
if @store == "[Uncategorized]"
#Get all uncategorized products
else
category = Category.find(@category)
#Get the products from that category
end
end
@petros
petros / controller.rb
Created July 13, 2010 12:16
Search conditions for a form_tag
def list_by_filter
@filterinfo = []
sql = "select i.* from installations i"
sqlconditions = ""
if params[:code] != nil
@code = params[:code]
sqlconditions += "code = '#{@code}'"
@filterinfo << "με κωδικό #{@code}"
end