Skip to content

Instantly share code, notes, and snippets.

Adrian Pike adrianpike

Block or report user

Report or block adrianpike

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@adrianpike
adrianpike / ff.sh
Created Jul 3, 2018
Quick way to find a filename in the usual way you're wanting to find a filename :)
View ff.sh
function find_filename() {
if [ "$1" != "" ]
then
find . -not -path '*/\.*' | grep -i $1
else
echo "Need a filename"
fi
}
alias ff=find_filename
View keybase.md

Keybase proof

I hereby claim:

  • I am adrianpike on github.
  • I am adrianpike (https://keybase.io/adrianpike) on keybase.
  • I have a public key ASBP5KHHMa5rjc4RMAqTrRocTCxPhivxYiXrUqigzoavpAo

To claim this, I am signing this object:

View gist:b25481938fed4209fd71
# https://blog.nvisium.com/2015/06/using-rails-5-attributes-api-today-in.html
class Foobar
def initialize
@foobar = '123'
end
end
View gist:9f7bcb424986ddd4c9af
require 'active_resource'
class ActiveResource::ConnectionError
def to_s
message = super
message << " Response body = #{response.body}." if response.respond_to?(:body)
message
end
end
View archive.scpt
-- Put this into your Outlook scripts folder (~/Library/Application Support/Microsoft/Office/Outlook Script Menu Items/)
on run {}
tell application "Microsoft Outlook"
set msgs to current messages
if ((count of msgs) < 1) then return
set mailFolders to mail folders
repeat with fld in mailFolders
if (name of fld is "Archived") then
View keybase.md

Keybase proof

I hereby claim:

  • I am adrianpike on github.
  • I am adrianpike (https://keybase.io/adrianpike) on keybase.
  • I have a public key whose fingerprint is 01E0 8AF8 07B0 DB71 C2D4 E6CF 8E7F 01E8 848A 6AB4

To claim this, I am signing this object:

View gist:6444087
counts: {
foo: {
a: 50
b: 60
}
bar: {
a: 6312
}
zulu:{
c: 21
View gist:4958051
foo = ['a','b','c']
bars = _.map(foo, function(obj) {
return 'a' + obj;
})
#### VS ####
bars = 'a' + obj for obj in foo
View mp.rb
class MagicalPresenter < Draper::Base
extend ActiveModel::Naming
include ActiveModel::Conversion
attr_reader :changes
def initialize(model, opts = {})
@changes = {}
super(model)
end
View gist:4069543
= form_for(:artwork_tag, :url => "/artworks/#{@artwork.id}/tags/create", :html => { :method => :create, :class => 'form-horizontal' }, :remote => true) do |f|
.control-group
= f.hidden_field :artwork_id, :value => @artwork.id
= f.hidden_field :user_id, :value => current_user.id
= f.text_field :tag_name, :class => "input-medium"
= f.submit "Add Tag", :class => "btn btn-small btn-primary"
You can’t perform that action at this time.