Skip to content

Instantly share code, notes, and snippets.

View julik's full-sized avatar
💭
🎺

Julik Tarkhanov julik

💭
🎺
View GitHub Profile

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

@julik
julik / parser.py
Created November 26, 2013 10:39
Yo dawg, I heard you like Nuke so I wrote this so that you can parse your Nuke TCL while you tickle yo' Python. Ya dig?
TERMINATORS = ["\n", ";"]
ESC = "\\"
QUOTES = ['"', "'"]
class c:
"""
Will be at the start of a list representing an expression
in curly braces. Every c() is equal to any other c()
"""
@julik
julik / artboards_to_svg.jsx
Last active December 27, 2015 07:39
Export every Illustrator artboard to SVG without resaving your file under different names and showing you any dialogs
var exportToDir = "/Users/julik/Code/apps/mvp/public/icons/";
/* Crop every icon in your Illustrator file witha named artboard. This script will export them all */
var docRef = app.activeDocument;
docRef.save();
// Get the source path
var originalPath = app.activeDocument.fullName.toString();
// Allocate a copy of the current document that we will throw away. We do this
uniform sampler2D input1;
uniform float adsk_input1_w, adsk_result_w;
void main()
{
// this should output the width of the input1 into the G channel of the shader,
// but it's value is always zero. And it wasn't. The test_shader stipulates that
// adsk_{sampler_name}_w / adsk_{sampler_name}_h : when declared as a float
// uniform, this gives access to each texture's resolution
// but it's broken now
@julik
julik / copier.js
Created August 19, 2013 10:18
Copypaste implementation
// Detect Control/Shift/Alt key status
var CTRL = false;
var SHIFT = false;
var ALT = false;
var CHAR_CODE = -1;
var menuItemDiv = null;
var curMouseX, curMouseY;
@julik
julik / holdit.py
Created July 26, 2013 15:34
Break out of the ReadGeo range with first/last frame holds
readgeo = nuke.selectedNode()
# register the first frame of the selected readgeo
hold_first = int(readgeo["range_first"].value())
# and the last frame
hold_last = int(readgeo["range_last"].value())
# generate the holds
hold_before = nuke.nodes.FrameHold(first_frame = hold_first)
hold_before.setInput(0, readgeo)
@julik
julik / fork_and_forget.rb
Created April 8, 2013 08:07
Le fork and forget picked up on Pastebin
#! /usr/bin/env ruby
# "Fork and Forget"
# Don't wait if you don't have to: A mini-tutorial about concurrency
# mechanisms in Ruby and basic Unix systems programming, and how you can use
# them to avoid waiting.
#
# I have heard that people are occasionally unfamiliar with this strategy.
# It's a common idiom, regardless of language, and it is also essentially built
# into Erlang (and Termite Scheme, etc.).
#
@julik
julik / sortof.rb
Last active December 15, 2015 11:49
def path
super || own_computed_path
end
private
def own_computed_path
path_components = [parent_path]
if node_id && !parent_path.empty?
path_components.push '[%s]' % node_id
class OxMama
def path
end
end
class WyrwiGlaz < OxMama
def parent_path
'junk'
end
@julik
julik / namespace.coffee
Created March 24, 2013 17:29
A wrapper to let everything you define happen under the window.app object
using = (context, args..., f) -> f.apply(context, args)
window.app = {}
window.inApp = (f) ->
using window.app, f