Skip to content

Instantly share code, notes, and snippets.

Jonas Grau jgrau

Block or report user

Report or block jgrau

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am jgrau on github.
  • I am jgrau (https://keybase.io/jgrau) on keybase.
  • I have a public key ASDooTkZGBqM8T3cqDQolznE87B4pTov1LYG_7ehACY94wo

To claim this, I am signing this object:

@jgrau
jgrau / update-all-gems
Created Aug 15, 2016
A ruby script to update all gems one by one; running tests between each updated gem and committing to git.
View update-all-gems
#!/usr/bin/env ruby
# Makes accessing the latest exitstatus a bit easier
require 'English'
# Updates all the outdated gems one by one and commits the changes
# for every gem update. This should make it a lot easier to revert
# a gem update.
class UpdateAllGems
def self.run
@jgrau
jgrau / create_labels.sh
Created Jun 27, 2016 — forked from Chompas/create_labels.sh
Bash script to create multiple Github labels at once
View create_labels.sh
#!/usr/bin/env bash
# This is a modification from https://gist.github.com/omegahm/28d87a4e1411c030aa89
# Colours and convention picked from https://robinpowered.com/blog/best-practice-system-for-organizing-and-tagging-github-issues/
## Instructions
# Bash 4+ is needed because of associative arrays
# jq (https://stedolan.github.io/jq/)
# Create access Token from Github (https://help.github.com/articles/creating-an-access-token-for-command-line-use/) and save it under ".token" file
# Comment / Uncomment / Add, all the labels you want
@jgrau
jgrau / gist:3787671
Created Sep 26, 2012
Example C# documentation
View gist:3787671
/// <summary>
/// This class performs an important function.
/// </summary>
public class TestClass
{
// Single parameter.
/// <param name="Int1">Used to indicate status.</param>
public static void DoWork(int Int1)
{
}
View gist:959953
sum = 0
"23:34:02".split(":").each_with_index do |n, i|
case i
when 0
sum = sum+n.to_i*60*60
when 1
sum = sum+n.to_i*60
when 2
sum = sum+n.to_i
end
View gist:959937
Time.now + (Time.parse("23:34:02").to_i-Time.now.to_i)
@jgrau
jgrau / devise.da.yml
Created Oct 21, 2010
Updated to accomodate devise 1.4.5
View devise.da.yml
da:
errors:
messages:
expired: "er udløbet. Vær venlig at bede om en ny"
not_found: "ikke fundet"
already_confirmed: "er allerede bekræftet"
not_locked: "var ikke låst"
not_saved:
one: "1 fejl medførte at denne %{resource} ikke kunne gemmes:"
other: "%{count} fejl medførte at denne %{resource} ikke kunne gemmes:"
View views_migration
class CreateViews < ActiveRecord::Migration
def self.up
create_table :views, :force => true do |t|
t.references :loggable, :polymorphic => true
t.string :session_id
t.string :originating_ip
t.string :uri
t.timestamps
end
end
View syntax error
# ofcause action_path doesn't work with this syntax
def init_and_slug_redirect
@place = Place.published.find(params[:id])
action = self.action_name
redirect_to action_path(@place), :status => :moved_permanently unless @place.friendly_id_status.best?
end
You can’t perform that action at this time.