Skip to content

Instantly share code, notes, and snippets.

View capitalist's full-sized avatar
🎯
Focusing

Joe Martinez capitalist

🎯
Focusing
View GitHub Profile
@capitalist
capitalist / heroicons_with_surface.ex
Created October 17, 2020 13:05 — forked from lnr0626/heroicons_with_surface.ex
A module for handling svg icons both with and without surface
defmodule HeroiconWithSurface do
@moduledoc """
This assumes https://github.com/tailwindlabs/heroicons has been cloned as a submodule to svgs/heroicons
Examples:
<#HeroiconWithSurface variant="outline" icon="phone" class="w-5 h-5" />
<%= HeroiconWithSurface.svg({"outline", "phone"}, class: "w-5 h-5") %>
"""
use SvgIcons,
@capitalist
capitalist / julia-env.sh
Last active May 13, 2017 01:25 — forked from moisespsena/julia-env.sh
Install Latest Julia Stable enviroment on Debian
#!/bin/bash
SD=$(dirname $(realpath "$0")) || exit 1
[ `arch` = 'x86_64' ] && url='https://julialang.s3.amazonaws.com/bin/linux/x64/0.5/julia-0.5.2-linux-x86_64.tar.gz' \
|| url='https://julialang.s3.amazonaws.com/bin/linux/x86/0.5/julia-0.5.2-linux-i686.tar.gz'
echo $url
tmpd="$SD/tmp"
Mustache.to_javascript("Hello {{planet}}")
class MyView < Mustache
def cache_by_user_id
lambda do |text|
cache_key = "user:#{current_user.id}"
if value = $cache.get(cache_key)
value
else
rendered = render(text)
$cache.set(cache_key, rendered)
rvm install 1.8.7 --debug -C --with-readline-dir=$HOME/.rvm/usr,--with-iconv-dir=$HOME/.rvm/usr,--enable-shared
rvm 1.8.7
wget http://downloads.sourceforge.net/project/rubycocoa/RubyCocoa/1.0.1/RubyCocoa-1.0.1.tar.gz?use_mirror=superb-sea2
tar zxf RubyCocoa-1.0.1.tar.gz
cd RubyCocoa-1.0.1
ruby install.rb config --target-archs=x86_64
ruby install.rb setup
rvmsudo ruby install.rb install
gem install xrefresh-server
require 'spec/runner/formatter/progress_bar_formatter'
# Put this in spec/support and run with:
# spec spec --require spec/support/no_shoulds_punk_formatter.rb --format NoShouldsPunkFormatter
class NoShouldsPunkFormatter < Spec::Runner::Formatter::ProgressBarFormatter
def initialize(options, output)
super
@examples_with_should = []
require 'webrick'
require 'webrick/httpproxy'
require 'fileutils'
require 'md5'
###
# FakeWebRecorder is an HTTP Proxy that records sessions as calls to FakeWeb.
# The code that FakeWebRecorder generates should be suitable for testing
# interaction with a particular website.
#
When /^(.*) in the "([^\"]*)" section$/ do |action, title|
within "//*[(h1|h2|h3|h4|h5|h6|legend|caption)/descendant-or-self::*[contains(text(), '#{title}')]]" do
When action
end
end
When /^(.*) in the "([^\"]*)" row$/ do |action, title|
within "//*[(th|td)/descendant-or-self::*[contains(text(), '#{title}')]]" do
When action
end
require 'strscan'
require 'set'
class SqlQuery < Struct.new(:table, :where, :order)
def to_json
[table, where, order].to_json
end
end
class SqlScanner