Skip to content

Instantly share code, notes, and snippets.

View smeevil's full-sized avatar
🥰
Hugs for all!

Gerard de Brieder smeevil

🥰
Hugs for all!
  • Govannon
  • Netherlands
View GitHub Profile
@smeevil
smeevil / price_formatter.ex
Created August 25, 2015 09:07
price formatter
defmodule Sheep.PriceFormatter do
def format(number) when is_integer(number) do
"€ " <> (number |> set_decimal |> Float.to_string(decimals: 2) |> set_separators)
end
def format(not_a_number) do
string_number = not_a_number |> to_string |> String.replace(~r/\D/, "")
{number, _} = Integer.parse(string_number)
number |> format
end
@smeevil
smeevil / gist:7649b617f2bc8ee03f8a
Created September 16, 2015 11:51
Phoenix hidden field with boolean value
In phoenix when using a hidden field that should contain the value of a boolean with "<%= hidden_input f, :anonymous %>" it renders the following :
When true :
<input id="investment_anonymous" name="investment[anonymous]" type="hidden" value="value">
When false :
<input id="investment_anonymous" name="investment[anonymous]" type="hidden">
I would expect it to render the following :
@smeevil
smeevil / IntelliJ_IDEA__Perf_Tuning.txt
Created April 4, 2017 19:19 — forked from P7h/IntelliJ_IDEA__Perf_Tuning.txt
Performance tuning parameters for IntelliJ IDEA. Add these params in idea64.exe.vmoptions or idea.exe.vmoptions file in IntelliJ IDEA. If you are using JDK 8.x, please knock off PermSize and MaxPermSize parameters from the tuning configuration.
-server
-Xms2048m
-Xmx2048m
-XX:NewSize=512m
-XX:MaxNewSize=512m
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:+UseParNewGC
-XX:ParallelGCThreads=4
-XX:MaxTenuringThreshold=1
1. In Library/LaunchDaemons create a file named limit.maxfiles.plist and paste the following in (feel free to change the two numbers (which are the soft and hard limits, respectively):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxfiles</string>
<key>ProgramArguments</key>

Keybase proof

I hereby claim:

  • I am smeevil on github.
  • I am smeevil (https://keybase.io/smeevil) on keybase.
  • I have a public key ASBOjzbEMuSL7Dm11vlW5GwW6-DgFhuclmXHjCU7X3gc-Qo

To claim this, I am signing this object: