Skip to content

Instantly share code, notes, and snippets.

View djthread's full-sized avatar

Adam Bellinson djthread

  • STX
  • Metro Detroit, MI
View GitHub Profile
defmodule Foo do
def bar do
:bar
end
end
defmodule Weird do
@moduledoc """
Illustrates a weird behavior I noticed which doesn't seem to make sense.
defmodule WackyMacro do
defmacro defalias(alias_name, alias_path) do
quote bind_quoted: [alias_name: alias_name, alias_path: alias_path] do
defmacro unquote(:"get_#{alias_name}")(path) do
quote bind_quoted: [path: path, alias_path: alias_path] do
get(var!(assigns).render_meta.parsed, alias_path ++ path)
end
end
end
end
@djthread
djthread / nginx.conf
Created July 22, 2018 22:16 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
### Keybase proof
I hereby claim:
* I am djthread on github.
* I am thread (https://keybase.io/thread) on keybase.
* I have a public key whose fingerprint is 13E7 DF84 0256 04AF 57D1 89B7 D237 5901 CCA1 144C
To claim this, I am signing this object:
@djthread
djthread / gist:3838010
Created October 5, 2012 04:02
coffeescript encapsulation
# without a class
thing = ->
thePrivate = -> console.log "I'm private"
thePublic: -> console.log "I'm public"
t = thing()
t.thePublic()
t.thePrivate()
# with one
postSetupHandler = null
launch = (tmp) ->
postSetupHandler = tmp
log.log ""
log.log "PodProxy Starting..."
filesystem.readFile 'db/config.json', loadConfigFile
# We let these functions block since everything we do needs configuration and feeds
loadConfigFile = (err, data) ->
@djthread
djthread / gist:3558936
Created August 31, 2012 21:01
chaining file reads?
loadConfigFile = (err, data) ->
log.log "Reading Global Config File..."
if err
log.log 'db/config.json not found. starting new one..'
else
for key, val of JSON.parse data
if config[key] != undefined then config[key] = val
log.log "Loaded."
log.log ""
filesystem.readFile 'db/feeds.json', loadFeedsFile