NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
| #! /bin/sh | |
| # TODO: parse & pass-through sudo options from $@ | |
| sudo_options="-E" | |
| scls=$X_SCLS | |
| #available_scls="`scl --list | tr '\n' ' ' | sed 's/ $//'`" | |
| for arg in "$@" | |
| do | |
| case "$arg" in | |
| *\'*) |
| #!/usr/bin/env python2 | |
| import SimpleHTTPServer | |
| import SocketServer | |
| import logging | |
| PORT = 8000 | |
| class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): |
NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
| def root= new File('/usr/share') | |
| def full= new File('/usr/share/docs/rpm-4.4') | |
| // Print the relative path of 'full' in relation to 'root' | |
| // Notice that the full path is passed as a parameter to the root. | |
| def relPath= new File( root.toURI().relativize( full.toURI() ).toString() ) |
| # Example Rakefile that demonstrates how to add task dependencies | |
| # to custom rake tasks that don't allow for the normal rake task | |
| # behaviour around setting task dependencies. | |
| require 'cucumber/rake/task' | |
| # here's the task that I want to run before any of my cucumber tasks (see below) | |
| namespace :stub do | |
| desc "Start stub required by features" | |
| task :start do |
| import javax.crypto.Cipher; | |
| import java.security.NoSuchAlgorithmException; | |
| public class KeyLengthDetector { | |
| public static void main(String[] args) { | |
| int allowedKeyLength = 0; | |
| try { | |
| allowedKeyLength = Cipher.getMaxAllowedKeyLength("AES"); | |
| } catch (NoSuchAlgorithmException e) { |
| require 'logger' | |
| # Monkeypatch a 'trace' loglevel into ruby Logger | |
| class Logger | |
| module Severity; TRACE=-1;end | |
| def trace(progname = nil, &block);add(TRACE, nil, progname, &block);end | |
| def trace?; @level <= TRACE; end | |
| end | |
| l = Logger.new(STDERR) | |
| l.level = Logger::TRACE |
| #!/bin/bash | |
| # git-standup: find out what you did yesterday (or last friday). | |
| # | |
| # Setup: | |
| # 1. Change AUTHOR if your git user doesn't match your unix account. | |
| # 2. Save somewhere on your path, make executable. | |
| # 3. git config --global alias.standup '!git-standup' | |
| # 4. Profit. | |
| # | |
| # Original idea via @paulgreg (https://twitter.com/paulgreg/status/248686055727972352) |
| <?php | |
| /* | |
| original code by cogitom: https://gist.github.com/997980/ | |
| This script reads future events (plus several days into the past) from Facebook pages | |
| and creates a subscribable iCalendar | |
| Improvements upon the original version: | |
| - fixed start and endtime reading | |
| - timezone adjustment done on facebook's side (more reliable) |
| <?php | |
| // https://github.com/facebook/php-sdk/ | |
| require_once 'path/to/facebook.php'; | |
| // http://www.kigkonsult.se/iCalcreator/ | |
| require_once 'path/to/iCalcreator.class.php'; | |
| $config = array( | |
| 'appId' => 'xxxx',//change to your fb app id | |
| 'secret' => 'yyyy',//change to your fb app secret | |
| 'pageId' => 'shimokitazawa.osscafe',//change to target fb page id |