This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Solarized Dark | |
For use with Jekyll and Pygments | |
http://ethanschoonover.com/solarized | |
SOLARIZED HEX ROLE | |
--------- -------- ------------------------------------------ | |
base03 #002b36 background | |
base01 #586e75 comments / secondary content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- reset sequence to the max value of its ids | |
SELECT setval('public.mytable_id_seq', (SELECT MAX(id) FROM mytable)); | |
-- get the last value of a sequence | |
SELECT last_value FROM mytable_id_seq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
publicString formatDateAsUTC(Date date) { | |
Calendar calendar = Calendar.getInstance(); | |
calendar.setTime(date); | |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss'Z'"); | |
sdf.setTimeZone(TimeZone.getTimeZone("UTC")); | |
return sdf.format(date); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove comment that spans a whole line (like this one) | |
# and comments at the end of a line like the following | |
: echo "Hello" # comment at the end of a line | |
sed -e 's/#.*$//g' -e '/^[ \t]*$/d' file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl $URL --data @$FILE -vv -L -H "Content-Type:application/json" | |
# curl $URL --trace-ascii - --data @$FILE -L -H "Content-Type:application/json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tar cvzf ~/backup/project.tar.gz --dereference --exclude-vcs --exclude=/target/ project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I want to resize an image from 600x128 to 225x100 while keeping its aspect ratio. | |
# Resizing the width to 225 while keeping the aspect ratio makes one dimension (height) | |
# smaller (225x48) than what I want to obtain (225x100). | |
# The workaround is to resize first, | |
# then increase the canvas of the other dimension (height) | |
# to obtain the desired size (225x100) then center the image in the canvas. | |
#~~~~~~~~~~~~~~~~~~~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############ | |
## Problem | |
############ | |
bundle exec guard | |
... | |
(This may be due to symlinks pointing to parent directories). | |
Duplicate: /some/where/ebouchut/www/netadge/bo/rubymine/trunk/doc/simplecov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User # class User < ActiveRecord::Base | |
include ActiveModel::Model # | |
attr_accessor :name, :age | |
validates :name, presence: true | |
validates :age, presence: true, | |
numericality: { only_integer: true, greater_than: 0 } | |
end |
NewerOlder