Skip to content

Instantly share code, notes, and snippets.

@febeling
febeling / generate-icns.sh
Last active January 13, 2024 13:01 — forked from ahmed-musallam/generate-icns.sh
A Shell script to generate .ico and .icns files (mac/windows app icons) from a single PNG
#!/bin/bash
# Required deps:
# imagemagick: https://imagemagick.org/script/download.php
# iconutil: https://developer.apple.com/library/archive/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html
# name of your master icon, should be 1024x1024 or .svg
if [ -z "$PNG_MASTER" ]; then
# If not set, assign a default value
PNG_MASTER="icon-large.png"
fi
@febeling
febeling / Deploy a Phoenix app with Dokku.md
Created October 11, 2023 09:45 — forked from col/Deploy a Phoenix app with Dokku.md
Deploy a Phoenix app with Dokku
@febeling
febeling / eject.md
Created April 18, 2018 08:02 — forked from dayhaysoos/eject.md
eject command for React Native

Reconfigure

If your project has any issues with the native folders, you can rebuild them by deleting both the ios and android directories at the root level of your project and running this command:

$ react-native eject

Running this command will check if the ios and android directories exist and then rebuild whichever one is missing.

The first time you run this command it will spit out a configuration JSON file called app.json. By default, app.json will have 2 properties:

@febeling
febeling / model.ex
Created December 7, 2016 15:51 — forked from alanpeabody/model.ex
Ecto change password w/ confirmation.
defmodule User do
use Ecto.Model
schema "users" do
field :email, :string
field :hashed_password, :string
field :password, :string, virtual: true
field :password_confirmation, virtual: true
timestamps
@febeling
febeling / how-to-set-up-stress-free-ssl-on-os-x.md
Last active August 29, 2015 14:27 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
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

@febeling
febeling / introrx.md
Last active August 29, 2015 14:10 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

$(function() {
var source = new EventSource('/events');
source.onopen = function (event) {
console.log("eventsource connection open");
};
source.onerror = function() {
if (event.target.readyState === 0) {
console.log("reconnecting to eventsource");
} else {
console.log("eventsource error");
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.bz2
tar -xvjf ruby-1.9.3-p392.tar.bz2
cd ruby-1.9.3-p392/
./configure --prefix=/usr/local
make
make install