Skip to content

Instantly share code, notes, and snippets.

View DevL's full-sized avatar

Lennart Fridén DevL

View GitHub Profile
@stoft
stoft / point_mutations_perf_text.exs
Last active August 29, 2015 14:10
Exercism exercise "point mutations" performance test.
if System.get_env("EXERCISM_TEST_EXAMPLES") do
Code.load_file("example.exs")
else
Code.load_file("point_mutations.exs")
end
ExUnit.start
defmodule DNATest do
use ExUnit.Case, async: true
@joakimk
joakimk / Rakefile
Created October 2, 2012 11:24
Try to run no-rails rake tasks first and fallback to rails when none is found.
#!/usr/bin/env rake
# If the code below fails, uncomment this. There are no known issues now, but we had one.
#require File.expand_path('../config/application', __FILE__)
#Auctionet::Application.load_tasks
#require File.expand_path('../lib/tasks/no_rails', __FILE__)
#__END__
# Load all non-rails tasks.
path = File.expand_path('../lib/tasks/no_rails', __FILE__)
#!/usr/bin/env sh
SHRUG='¯\_(ツ)_/¯'
echo $SHRUG | tr -d '\n' | pbcopy
echo $SHRUG
@scotttam
scotttam / apns.rb
Created January 31, 2012 15:51
Sends an Apple Push Notification with Ruby
require "rubygems"
require "yajl"
require "openssl"
require "socket"
device_token = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62'
device_token = device_token.gsub(" ", "")
the_byte_token = [device_token].pack("H*")
file = File.open("ruby_the_byte_token", "wb")
@SteveBenner
SteveBenner / macfix1-install-nokogiri.rb
Last active August 13, 2019 14:52
Mac fix - Install Nokogiri gem on OS X 10.9 Mavericks
#!/usr/bin/env ruby
#
# Mac fix 1 - Install the Nokogiri gem on Mac OS 10.9 Mavericks
#
# Usage: to configure and install using Bundler, pass in 'bundle' as an argument to the script.
#
# Nokogiri works at a very low level, so it has many issues on various platforms.
# As a result, the command `install gem nokogiri` often will fail. This fix is for
# errors involving 'libiconv', such as the following one I encountered:
#
@adolfont
adolfont / fav1.erl
Created June 7, 2022 12:11
Source code for Joe Armstrong's My favorite Erlang Program https://joearms.github.io/published/2013-11-21-My-favorite-erlang-program.html
-module(fav1).
-export([test/0]).
test() ->
Pid = spawn(fun universal_server/0),
Pid ! {become, fun fac_server/0},
Pid ! {self(), 50},
receive
X -> X
end.
@adamwiggins
adamwiggins / end-of-a-chapter.md
Last active November 24, 2022 11:40
End of a chapter: my Heroku departure message

It's with a heavy heart that I announce that Friday, May 31 2013 will be my last day at Heroku.

How can I possibly put into words what Heroku has meant to me these last six years? I can say it was a tremendous experience; or the opportunity of a lifetime; or the greatest thing I have ever been a part of. I can say that Heroku has been my life's work, as I did recently in a public blog post. All of those things are true, but none seem to capture the enormity of what's transpired these past six years.

I tend to focus on mechanical elements of a company: product, code, design, process. But what has surprised me the most at Heroku is that none of these things is the best part. The best part is the team.

I've never had the chance to work with a more singular group of people. Talented, passionate, skilled, dedicated. Most of all, sharing a set of values: elegance, craft, maniacal focus on simplicity; and an uncompromising belief that the future will be made of software, and how that software gets made will shape

@josephwecker
josephwecker / new_bashrc.sh
Created August 11, 2012 04:36
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful. Now a repo: https://github.com/josephwecker/bashrc_dispatch
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# -- DEPRICATED --
# This gist is slow and is missing .bashrc_once
# Use the one in the repo instead! https://github.com/josephwecker/bashrc_dispatch
# (Thanks gioele)
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 25, 2024 17:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: