Skip to content

Instantly share code, notes, and snippets.

View archfear's full-sized avatar

Dan Dofter archfear

  • BrightHire
  • San Francisco, CA
View GitHub Profile
@archfear
archfear / install-wget2
Last active March 18, 2023 20:37 — forked from davdenic/install-wget2
Install wget2 on macos
git clone https://gitlab.com/gnuwget/wget2.git
cd wget2
git checkout v2.0.1
brew install automake brotli doxygen gettext gettext gnutls gpgme libidn2 libmicrohttpd libpsl libtool lzlib nettle nghttp2 pandoc pcre pkg-config texinfo xz zstd
./configure --with-bzip2 --with-lzma --without-libhsts
make
make check
make install
### Keybase proof
I hereby claim:
* I am archfear on github.
* I am archfear (https://keybase.io/archfear) on keybase.
* I have a public key whose fingerprint is 4971 2540 1735 0EE3 24F6 AF55 4AB2 E7ED 0F99 713C
To claim this, I am signing this object:
@archfear
archfear / PlaceholderTextView
Created April 9, 2015 21:10
Subclass of UITextView that allows placeholder text
import UIKit
class PlaceholderTextView: UITextView {
var placeholder: String {
get {
return placeholderTextView.text
}
set {
placeholderTextView.text = newValue
@archfear
archfear / fix_whitespace.rake
Last active December 27, 2015 17:59
Pre-commit hook for git which removes trailing whitespace, converts tabs to spaces and adds a newline to the end of the file if missing.
script_file = File.join(Rails.root, "script", "git_fix_whitespace.sh")
desc "Remove trailing whitespace and convert tabs to spaces"
task :fix_whitespace do
`sh #{script_file} -f`
end
namespace :fix_whitespace do
desc "Installs a git pre-commit hook which removes trailing whitespace and converts tabs to spaces"
task :install, :force do |t, args|
@archfear
archfear / chrome-profile
Created November 8, 2013 04:13
This script creates an app which launches Google Chrome with a new profile and allows for running multiple instances of Chrome simultaneously.
#!/bin/bash
#
# This script creates an app which launches Google Chrome with a new profile
# and allows for running multiple instances of Chrome simultaneously.
#
# Based on: http://blog.duoconsulting.com/2011/03/13/multiple-profiles-in-google-chrome-for-os-x/
set -e
if [ $# == 0 ]; then
# Dan Croak, February 2008
# updated by Dan Dofter, February 2010
VENDORED_HAML_BIN = Dir["#{Rails.root}/vendor/gems/haml*/bin"].first
VIEWS_DIR = "#{Rails.root}/app/views"
CSS_DIR = "#{Rails.root}/public/stylesheets"
SASS_DIR = "#{VIEWS_DIR}/stylesheets"
def convert_css_to_sass(css_file)
namespace :assets do
namespace :js do
desc "Package JavaScript"
task :package do
puts "Packaging path.js..."
repackage_javascript
end
namespace :package do
task "pre-commit" do
file 'Gemfile', <<-GEMS
source 'http://gemcutter.org'
gem "rails", "3.0.0.beta3"
gem "bson_ext"
gem "mongoid", "2.0.0.beta4"
gem "haml", "3.0.0.rc.2"
gem "compass", "0.10.0.rc4"
gem "inherited_resources"
group :test do
# Dan Croak, February 2008
# updated by Dan Dofter, February 2010
VIEWS_DIR = "#{RAILS_ROOT}/app/views"
CSS_DIR = "#{RAILS_ROOT}/public/stylesheets"
SASS_DIR = "#{VIEWS_DIR}/stylesheets"
def convert_css_to_sass(css_file)
if css_file =~ /^(.*)(\.css)$/
basename = $1
##
# test/spec/mini 2
# http://gist.github.com/25455
# [email protected]
# file:lib/test/spec/mini.rb
#
def context(*args, &block)
return super unless (name = args.first) && block
require 'test/unit'
klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do