Skip to content

Instantly share code, notes, and snippets.

View julik's full-sized avatar
💭
🎺

Julik Tarkhanov julik

💭
🎺
View GitHub Profile
# 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
@julik
julik / inspect_headers.rb
Created December 24, 2013 22:16
Inspect Rack headers going through a middleware step
# Somehow Firefox 3 on Flame Oldest Linux In The Universe
# gets the .tgz files double-cooked compressed. This MW is
# intrduced to verify why that happens
class HeaderSniffer
def initialize(app, path_regexp = /\.tgz/)
@path_regexp = path_regexp
@app = app
end
def call(env)
curl http://logik-matchbook.org/MatchboxShaderCollection.tgz | tar xfz -; cp -r shaders /wherever-you-want/
curl http://logik-matchbook.org/MatchboxShaderCollection.tgz | tar xfz - && ./INSTALL.command
@julik
julik / digest.rb
Created December 9, 2013 11:08
digest a file with Ruby via OpenSSL
require 'openssl'
def digest_file(file_path, digest_class)
chunk_size = 1024 * 1024 # a meg
d = digest_class.new
File.open(file_path, 'r') do | f |
while chunk = f.read(chunk_size) do
d << chunk
end
end