#write out current crontab
crontab -l > mycron
#echo new cron into cron file
echo "00 09 * * 1-5 echo hello" >> mycron
#install new cron file
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/sh | |
if [ $# -ne 1 ]; then | |
echo 'Usage: git-branch-description <branch name>' >&2 | |
exit 1 | |
fi | |
EDITOR='cat' git branch --edit-description "$1" | grep -v '^#' |
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
require 'socket' | |
socket = TCPSocket.new('localhost', 7894) | |
socket.puts "'B'*50024" | |
all_data = [] | |
while partial_data = socket.read(2024) | |
puts partial_data | |
puts "-------------------------" | |
all_data << partial_data |
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
# active_admin and formtastic seem kinda picky about displaying both the | |
# image and the file input together here... in fact, it seems like this | |
# is the ONLY way to do this? Adding anything else after the image_tag squashes it. | |
ActiveAdmin.register Film do | |
form do |f| | |
f.inputs "Film" do | |
f.input :title | |
end | |
f.has_many :stills do |film_still_form| |
Я не сторонник лишних gems. Если необходим какой-либо несистемный функционал (например, state machine), то вместо того, чтобы тянуть в проект какую-то стороннюю OpenSource либу (которая вместе с нужным функционалом добавляет ненужный потайной функционал "магического характера"), я лучше потрачу тоже самое время на разработку собственной библиотеки, которая может уместиться в 1-3 класса, чем разбираться в коде и в случае багов выяснять, где проблема: "у нас или у них там в геме?". Либо выдеру из гема нужный мне код без лишнего.
Ответ на вопрос:
- rspec
- composite_primary_keys
- omniauth (omniauth-instagram, omniauth-vkontakte, omniauth-google-oauth2)
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
# Accepts a list and a key function to apply to each item, | |
# and then uses a decorate-sort-undecorate pattern to actually | |
# do the sorting. Returns a new list. Keeps track of the index | |
# to make sure the sort is stable. | |
sort_by = (list, key) -> | |
cmp = ({key: k_a, index: i_a}, {key: k_b, index: i_b}) -> | |
if k_a == k_b then i_a - i_b else if k_a < k_b then -1 else 1 | |
decorated = ({item, index, key: key item} for item, index in list) | |
item for {item} in decorated.sort cmp |
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
`/** @jsx React.DOM */` | |
converter = new Showdown.converter | |
Comment = React.createClass | |
render: -> | |
rawMarkup = converter.makeHtml @props.children.toString() | |
`<div className="comment"> | |
<h2 className="comment">{this.props.author}</h2> | |
<span dangerouslySetInnerHTML={{__html: rawMarkup}} /> |
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
source "https://rubygems.org" | |
gem 'puma' | |
gem 'sinatra' |
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
# My First React Component | |
# Added to this Gist for posterity. | |
# Extracted from https://github.com/ministrycentered/transposr/commit/fa616871914ac16b72d0d1b035a08e01e337bd07 | |
# January 08, 2014 | |
{ div, input } = React.DOM | |
AudioFileStepSelector = React.createClass | |
getInitialState: -> | |
halfSteps: 2 |
OlderNewer