Skip to content

Instantly share code, notes, and snippets.

View att14's full-sized avatar
🐢

Andrew Tribone att14

🐢
View GitHub Profile
@att14
att14 / zoomMuteState.1s.scpt
Created May 20, 2024 17:22
SwiftBar Zoom State
#!/usr/bin/osascript
# <swiftbar.hideAbout>true</swiftbar.hideAbout>
# <swiftbar.hideRunInTerminal>true</swiftbar.hideRunInTerminal>
# <swiftbar.hideLastUpdated>true</swiftbar.hideLastUpdated>
# <swiftbar.hideDisablePlugin>true</swiftbar.hideDisablePlugin>
# <swiftbar.hideSwiftBar>false</swiftbar.hideSwiftBar>
property btnTitle : "Mute audio"
@att14
att14 / .gitignore
Last active May 4, 2020 18:01 — forked from victoryftw/classifications-api.md
EasyPost Duties and Taxes API Documentation
.DS_Store
require "typhoeus"
hydra = Typhoeus::Hydra.new
requests = 200.times.map { Typhoeus::Request.new('localhost:4567', method: :get, timeout: 5) }
requests << Typhoeus::Request.new('localhost:4567/timeout', method: :get, timeout: 5)
requests.each { |request| hydra.queue request }
hydra.run
Module Module1
Sub Main()
EasyPost.Client.apiKey = "..."
Dim fromAddress As New EasyPost.Address
With fromAddress
.phone = "1234567890"
.name = "Andrew Tribone"
.email = "[email protected]"
@att14
att14 / object.rb
Last active August 29, 2015 14:11
Macro for adding an `initialize` function and creating `attr_reader`s for each variable passed.
class Object
def self.init(*names)
define_method(:initialize) do |*args|
names.zip(args).each do |name, arg|
instance_variable_set("@#{name}", arg)
end
singleton_class.class_eval do
attr_reader *names
end
@att14
att14 / to_object.py
Last active December 28, 2015 20:19
Don't do this.
from collections import namedtuple
from new import instancemethod
def to_object(name, dictionary, base_class=object, functions=None, properties=None):
functions = functions or {}
properties = properties or {}
class Object(base_class):
@att14
att14 / helpful.md
Last active December 18, 2015 02:39

Helpful

A collection of seemingly helpful information.

Git

Think like a Git

Databases

@att14
att14 / decorator.py
Last active April 25, 2019 08:32
Decorators can be dangerous
def double(func):
def wrapped(*args, **kwargs):
return func(*args, **kwargs) * 2
return wrapped
def increment(func):
def wrapped(*args, **kwargs):
return func(*args, **kwargs) + 1
return wrapped
@att14
att14 / property.py
Last active December 17, 2015 19:09
Creates a getter and a setter for any attr on an object.
def _property(attr):
def __get(self):
return getattr(self, attr)
def __set(self, value):
setattr(self, attr, value)
return property(__get, __set)
@att14
att14 / lambda_tuple.py
Last active December 12, 2015 08:18
Lambda tuple expansion
t = lambda x: (lambda a, b: a * b)(*x)
t((5, 2)) # 10