Skip to content

Instantly share code, notes, and snippets.

View julik's full-sized avatar
💭
🎺

Julik Tarkhanov julik

💭
🎺
View GitHub Profile
@julik
julik / mute.applescript
Created November 17, 2014 13:26
Mute/unmute (for PowerMate, thanks to AJ)
-- http://blog.coolaj86.com/articles/how-to-control-os-x-system-volume-with-applescript/
set isMuted to output muted of (get volume settings)
if isMuted then
set volume without output muted
else
set volume with output muted
end if
@julik
julik / passthrough_tgz.rb
Created June 19, 2014 23:57
Do not double-cook tarballs when serving them via Rack
# Wrapper for Rack::Deflater that will prevent
# the said Deflater from EVER touching .tgz files
class PassthroughDeflater
BYPASS_FILES = /\.(t?)gz$/
# bypass_url_regexp will be matched against PATH_INFO
def initialize(app, bypass_url_regexp = BYPASS_FILES)
@bypass_url_regexp = bypass_url_regexp
@app = app
@deflater = Rack::Deflater.new(@app)
  • Why I need to rename stuff (again) when moving from minitest 4 to minitest 5?
  • Why a 0.x upgrade of ActiveRecord forces my project to minitest 5 even though my project is on 4?
  • Why Rake runs the autorunner for every thread I start within my rake task that has nothing to do with minitest?
  • Why there is no "around wrapper" for every test method that is published, and if there is why did it's API had to change between 4 and 5?
  • When I require "test/unit" because somethign in my project wants to have Test::Unit, is that really necessary?
  • Who is responsible/maintaining the test task that is supplied in Rake?
require 'faraday'
class CertificatePinning < Faraday::Adapter::NetHttp
def configure_ssl(http, ssl)
super # configure MOAR SSL }
end
end
client = Faraday.new(:url => 'https://github.com') do |f|
f.request :url_encoded
# This line makes me sad
Faraday::Adapter.register_middleware File.expand_path(File.dirname(__FILE__)),
:certificate_pinning => [:CertificatePinning, 'certificate_pinning/certificate_pinning']
Faraday.new(:url => 'https://fancy-startup.io/api') do |f|
f.use :http_cache, store: @cache
f.request :url_encoded
f.response :logger
# Rig up livereload for frontend stuff
guard 'livereload', apply_js_live: false, apply_css_live: true do
# Do full reloads for everything except CSS
watch(%r{.+\.(js|coffee|erb)$})
# Do full reloads when we modify the bom.json file with
# our Javascripts listed in loading order
watch(%r{.+\/bom\.json$})
# Using live compilation has it's downsides.
import nuke,os
IMPULSE_FILTER_ENUM = 0
__version__ = (0,0,1)
def grow():
"""
Will make a Crop node that crops the frame to the union of the animated BBox of the nude currently selected.
For example, if you have a Tracker node that stabilizes an image this function will grow your bounding box
to include the whole stabilized image
"""
alias buby='bundle exec ruby'
alias brake='bundle exec rake'
alias bapistrano='bundle exec cap'
alias brackup='bundle exec rackup'
alias breakup='bundle exec rackup'
alias brails='bundle exec rails'
alias botgun='bundle exec shotgun --port 9292'
alias boreman='bundle exec foreman start'
alias brunicorn='bundle exec unicorn --port 9292'
alias bundel='bundle' # how Dutch
@julik
julik / telegraph.coffee
Last active January 3, 2016 16:49
Add leaf-to-branch signaling to React
# A module that allows us to send Backbone events up the tree of components
ReactTelegraph =
componentWillMount: ->
# Make BB events available to the component
_.extend @, Backbone.Events
componentWillUnmount: ->
# Remove all Backbone event listeners
@off null, null, null
@julik
julik / depgrep.rb
Created January 13, 2014 10:24
Dependency explorer - for when you desperately need to find which pre-release gem version added some stupid dependency you don't want.
require 'open-uri'
require 'pp'
gemname = 'sass'
arr = Marshal.load(open("https://rubygems.org/api/v1/dependencies?gems=#{gemname}"))
arr.sort! do | g1, g2 |
Gem::Version.new(g1[:number]) <=> Gem::Version.new(g2[:number])
end
# Now go grep for those dependencies