Skip to content

Instantly share code, notes, and snippets.

@jeregrine
jeregrine / exwx.exs
Created October 13, 2023 22:20 — forked from rlipscombe/exwx.exs
Using wxWidgets from Elixir
#!/usr/bin/env elixir
defmodule Canvas do
@behaviour :wx_object
@title "Canvas Example"
@size {600, 600}
def start_link() do
:wx_object.start_link(__MODULE__, [], [])
@jeregrine
jeregrine / wine.rb
Last active June 27, 2016 23:10 — forked from searls/wine.rb
Install wine via homebrew with directx patch for Stardew Valley
# NOTE: When updating Wine, please check Wine-Gecko and Wine-Mono for updates
# too:
# - http://wiki.winehq.org/Gecko
# - http://wiki.winehq.org/Mono
class Wine < Formula
desc "Wine Is Not an Emulator"
homepage "https://www.winehq.org/"
head "git://source.winehq.org/git/wine.git"
stable do
@jeregrine
jeregrine / phoenix-0.15-upgrade.md
Last active August 29, 2015 14:25 — forked from chrismccord/phoenix-0.15-upgrade.md
Phoenix upgrade instructions 0.14.x to 0.15.0

Sockets and Channels

A new socket behaviour has been introduced to handle socket authentication in a single place, wire up default channel assigns, and disconnect a user's multiplex connection as needed.

First things first, create a UserSocket module in web/channels/user_socket.ex and move all your channel routes from web/route.ex to the user socket: (replace MyApp with your application module)

0.14.x - web/router.ex:

defmodule MyApp.Router do
   ...
defmodule MyApp.CommentView do
use MyApp.Web, :view
@attributes ~W(id name inserted_at)
def render("show.json", %{data: comments}) when is_list(comments) do
for comment <- comments do
render("show.json", data: comment)
end
end
#!/usr/bin/env python
import random
obliqstrats = ['(Organic) machinery', '(This Line Intentionally Left Blank)', 'A line has two sides', 'A very small object -Its centre', 'Abandon desire', 'Abandon normal instructions', 'Accept advice', 'Accretion', 'Adding on', 'Allow an easement (an easement is the abandonment of a stricture)', 'Always first steps', 'Always give yourself credit for having more than personality', 'Always the first steps', 'Are there sections? Consider transitions', 'Ask people to work against their better judgement', 'Ask your body', 'Assemble some of the elements in a group and treat the group', 'Back up a few steps. What else could you have done?', 'Balance the consistency principle with the inconsistency principle', 'Be dirty', 'Be extravagant', 'Be less critical more often', 'Breathe more deeply', 'Bridges -build -burn', 'Call your mother and ask her what to do.', 'Cascades', 'Change ambiguities to specifics', 'Change instrument roles', 'Change nothing and continue with immaculate c
# Simple Phoenix authentication plug
#
# - based on Plug's session store
# - redirects unauthenticated requests to login page "/login/<request url>"
# - /static/... requests are not authenticated
# - authentication is valid as long as session is valid (you can change this behaviour easily)
# Because we need session to be fetched BEFORE this plug, we must put this to router.ex:
#----------------------------
gem 'rest-client', '~> 1.6.7'
gem 'nokogiri'
'''Provides utility functions for encoding and decoding linestrings using the
Google encoded polyline algorithm.
'''
def encode_coords(coords):
'''Encodes a polyline using Google's polyline algorithm
See http://code.google.com/apis/maps/documentation/polylinealgorithm.html
for more information.