Skip to content

Instantly share code, notes, and snippets.

View Zequez's full-sized avatar

Ezequiel Schwartzman Zequez

View GitHub Profile
@Zequez
Zequez / pause_spotify_after_every_track.py
Created August 19, 2023 13:35
Pause Spotify after every track
# This script was written by ChatGPT from the following prompt
# Could you write me a small script that runs on OSX that monitors the currently playing song on
# Spotify and when the song changes pauses for 30 seconds and then starts playing again?
import time
import subprocess
def run_applescript(script):
return subprocess.run(["osascript", "-e", script], capture_output=True, text=True)
@Zequez
Zequez / init.coffee
Last active February 26, 2023 15:19
Comment out JSX code on Atom
# If you worked with React and JSX you probably noticed that you can't use JS comments when inside JSX sections
# Add this to your Atom init script
# Then add 'ctrl-cmd-/': 'comment-jsx' to your keymap.cson
# Then when you are on a JS/JSX file, just press cmd+ctrl+/ to use JSX-style comments that work with JSX elements
# Is not the most efficient way, but it's the cleanest and reliable one
atom.commands.add 'atom-workspace', 'comment-jsx', ->
atom.config.set('editor.commentStart', '{/*', {scopeSelector: '.source.js.jsx'})
atom.config.set('editor.commentEnd', '*/}', {scopeSelector: '.source.js.jsx'})
for selection in atom.workspace.getActiveTextEditor().selections
import { Balances } from "./context/connected";
import { Contracts } from "../contracts";
import { ethers, BigNumber } from "ethers";
const TokensInventory = ({ balances, address, contracts }: { balances: Balances; address: string; contracts: Contracts }) => {
return (
<div id="inventory-top">
<div>
<div>
<aside>My Ubiquity Inventory</aside>
@Zequez
Zequez / cronometer-stylus.css
Created March 29, 2021 22:08
2 column Stylus style for Cron-o-meter
@-moz-document url-prefix("https://cronometer.com/") {
#cronometerApp {
width: 100%;
margin: 0;
max-width: none;
}
#cronometerApp > div > div > div > table {
width: 100%;
}
@Zequez
Zequez / kinto.ini
Created March 23, 2021 01:37
kinto.ini on development server
# Created at Mon, 22 Mar 2021 21:56:31 -0300
# Using Kinto version 14.2.0
# Full options list for .ini file
# https://kinto.readthedocs.io/en/latest/configuration/settings.html
[server:main]
use = egg:waitress#main
host = 127.0.0.1
port = %(http_port)s
@Zequez
Zequez / rotate.bookmarklet.js
Created March 9, 2016 04:08
Rotate screen bookmarklet for those times when someone publishes a rotated picture or anything like that and you don't want to break your neck
javascript:!function(){___rotate=window.___rotate||0,___rotate++,___rotate>3&&(___rotate=0);var t=document.documentElement,o=t.clientWidth,e=t.clientHeight,r=document.body,i=r.style;0===___rotate?(i.transform="",i.position="",i.width="",i.height="",i.left="",i.top=""):1===___rotate?(i.transform="rotate(90deg)",i.transformOrigin="top left",i.position="absolute",i.width=e+"px",i.height=o+"px",i.left="100%",i.top="0"):2===___rotate?(i.transform="rotate(180deg)",i.transformOrigin="top left",i.position="absolute",i.width=o+"px",i.height=e+"px",i.left="100%",i.top="100%"):3===___rotate&&(i.transform="rotate(270deg)",i.transformOrigin="top left",i.position="absolute",i.width=e+"px",i.height=o+"px",i.left="0",i.top="100%")}();
@Zequez
Zequez / dabblet.css
Created May 1, 2012 01:36
Font size in PT test.
/* Font size in PT test. */
body {
font-family: Verdana;
}
.pt, .in, .px {
float: left;
margin-right: 1px;
width: 60px;
@Zequez
Zequez / accepts_new_nested_associations.rb
Created March 28, 2012 04:13
Allow existing associations in accepts_nested_attributes_for
module ActiveRecord::NestedAttributes
module ClassMethods
def accepts_nested_attributes_for(*attr_names)
options = { :allow_destroy => false, :update_only => false }
options.update(attr_names.extract_options!)
# Modified stuff
#options.assert_valid_keys(:allow_destroy, :reject_if, :limit, :update_only)
options.assert_valid_keys(:allow_destroy, :reject_if, :limit, :update_only, :allow_existing)
@Zequez
Zequez / gist:1218098
Created September 14, 2011 23:26
ActiveRecord::AssociationTypeMismatch Full Trace
activerecord (3.1.0.rc8) lib/active_record/associations/association.rb:205:in `raise_on_type_mismatch'
activerecord (3.1.0.rc8) lib/active_record/associations/belongs_to_association.rb:6:in `replace'
activerecord (3.1.0.rc8) lib/active_record/associations/singular_association.rb:17:in `writer'
activerecord (3.1.0.rc8) lib/active_record/associations/builder/association.rb:49:in `block in define_writers'
activerecord (3.1.0.rc8) lib/active_record/base.rb:1745:in `block in assign_attributes'
activerecord (3.1.0.rc8) lib/active_record/base.rb:1741:in `each'
activerecord (3.1.0.rc8) lib/active_record/base.rb:1741:in `assign_attributes'
activerecord (3.1.0.rc8) lib/active_record/associations/association.rb:237:in `block in build_record'
activerecord (3.1.0.rc8) lib/active_record/base.rb:1563:in `initialize'
activerecord (3.1.0.rc8) lib/active_record/reflection.rb:190:in `new'
@Zequez
Zequez / attr_readonly_error.rb
Created September 6, 2011 15:07
attr_readonly error
# Model:
class User < ActiveRecord::Base
attr_readonly :email
end
# Controller:
user = User.new :email => 'foo@bar.com'