Skip to content

Instantly share code, notes, and snippets.

View szymon-jez's full-sized avatar

Szymon Jeż szymon-jez

View GitHub Profile
@likethesky
likethesky / elixirphoenix.bash
Last active June 7, 2024 17:26
Installing Elixir & the Phoenix framework with Homebrew on OS X
$ brew update && brew doctor # Repeat, until you've done *all* the Dr. has ordered!
$ brew install postgresql # You'll need postgres to do this... you may also need to 'initdb' as well. Google it.
$ brew install elixir
$ mix local.hex # Answer y to any Qs
$ createuser -d postgres # create the default 'postgres' user that Chris McCord seems to like -- I don't create mine w/a pw...
# Use the latest Phoenix from here: http://www.phoenixframework.org/docs/installation -- currently this is 1.0.3
# ** Answer y to any Qs **
$ mix archive.install https://github.com/phoenixframework/phoenix/releases/download/v1.0.3/phoenix_new-1.0.3.ez
@mudphone
mudphone / curry.exs
Last active August 29, 2015 14:20
Elixir Curry... is delicious
defmodule Math do
def add(x, y) do
x + y
end
def add(x, y, z) do
x + y + z
end
@rbishop
rbishop / README.md
Last active April 26, 2022 15:38
A super simple Elixir server for sending Server Sent Events to the browser.

Generate a new Elixir project using mix and add cowboy and plug as dependencies in mix.exs:

  defp deps do
    [
      {:cowboy, "~> 1.0.0"},
      {:plug, "~> 0.8.1"}
    ]
  end
@catsby
catsby / _output
Last active October 23, 2016 03:51
Requiring relatively with Elixir
$ ls
other_thing.exs
thing.exs
$ elixir thing.exs
calling other
other thing!
hooray!
@ceme
ceme / bash_curl_loop
Last active January 19, 2023 13:07
bash curl loop
while true; do sleep 1; curl http://www.google.com; echo -e '\n\n\n\n'$(date);done
@thash
thash / redis-server
Created September 10, 2012 05:09 — forked from lsbardel/redis-server-for-init.d-startup
Init.d Redis script for Fedora16
#!/bin/bash
#
# Init file for Redis server
#
# chkconfig: - 98 02
# description: Persistent key-value db
#
# processname: redis
# config: /etc/redis.conf
# pidfile: /var/run/redis.pid
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active August 26, 2024 11:06 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@guilleiguaran
guilleiguaran / expiring.rb
Created August 4, 2011 17:02
Expiring values with Ohm
module Ohm
module Expiring
def self.included(base)
base.send(:extend, ClassMethods)
end
module ClassMethods
def expire(ttl)
@@expire = ttl.to_i
end
@xenda
xenda / gist:1015005
Created June 8, 2011 18:26 — forked from dhh/gist:1014971
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end