This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024k | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
echo "/swapfile none swap sw 0 0 " | sudo tee -a /etc/fstab | |
echo 0 | sudo tee /proc/sys/vm/swappiness | |
echo vm.swappiness = 0 | sudo tee -a /etc/sysctl.conf | |
sudo chown root:root /swapfile | |
sudo chmod 0600 /swapfile | |
swapon -s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install liblua5.1-dev | |
sudo mkdir /usr/include/lua5.1/include/ | |
sudo cp /usr/include/lua5.1/* /usr/include/lua5.1/include/ | |
sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.1.so /usr/local/lib/liblua.so | |
hg clone https://code.google.com/p/vim/ | |
cd vim | |
./configure --with-features=huge \ | |
--enable-perlinterp \ | |
--enable-rubyinterp \ | |
--enable-pythoninterp=yes \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="form"> | |
{% set form = this.beginWidget('CActiveForm', { | |
'id': 'hoge-form', | |
'enableAjaxValidation': false, | |
}) %} | |
<p class="note">Fields with <span class="required">*</span> are required.</p> | |
{{ form.errorSummary(model) }} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install macvim --with-cscope --with-lua --override-system-vim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Custom interface that enables communication between Fragment and its Activity | |
public interface OnItemSelectedListener | |
{ | |
public void onItemSelected(String item); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage | |
let argv = CStringArray(["ls", "/"]) | |
posix_spawnp(nil, argv.pointers[0], nil, nil, argv.pointers, nil) | |
// Is this really the best way to extend the lifetime of C-style strings? The lifetime | |
// of those passed to the String.withCString closure are only guaranteed valid during | |
// that call. Tried cheating this by returning the same C string from the closure but it | |
// gets dealloc'd almost immediately after the closure returns. This isn't terrible when | |
// dealing with a small number of constant C strings since you can nest closures. But |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from datetime import datetime | |
import sublime_plugin | |
class TimestampCommand(sublime_plugin.EventListener): | |
"""Expand `isoD`, `now`, `datetime`, `utcnow`, `utcdatetime`, | |
`date` and `time` | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's assume you're driving Capybara in both RSpec request specs & Cucumber, | |
# for example you're using Cucumber as a design/documentation tool, and RSpec | |
# for the more boring integration tests. | |
# You don't want to duplicate your click-this-click-that helpers to e.g. | |
# log_in(username, password). | |
# You may also have model state setup code which can be shared/reused. | |
# Where can it go? How can it be loaded? I've been using the following approach: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# | |
# backup_redmine.sh | |
# modified by ronan@lespolypodes.com | |
# Inspiration: https://gist.github.com/gabrielkfr/6432185 | |
# | |
# Distributed under terms of the MIT license. | |
# -- VARS | |
DAY=`date +"%Y%m%d"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
html = %(<div class="field_with_errors">#{html_tag}</div>).html_safe | |
# add nokogiri gem to Gemfile | |
elements = Nokogiri::HTML::DocumentFragment.parse(html_tag).css "label, input" | |
elements.each do |e| | |
if e.node_name.eql? 'label' | |
html = %(<div class="clearfix error">#{e}</div>).html_safe | |
elsif e.node_name.eql? 'input' | |
if instance.error_message.kind_of?(Array) | |
html = %(<div class="clearfix error">#{html_tag}<span class="help-inline"> #{instance.error_message.join(',')}</span></div>).html_safe |
OlderNewer