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
<?php | |
function register() | |
{ | |
if (!empty($_POST)) { | |
$msg = ''; | |
if ($_POST['user_name']) { | |
if ($_POST['user_password_new']) { | |
if ($_POST['user_password_new'] === $_POST['user_password_repeat']) { | |
if (strlen($_POST['user_password_new']) > 5) { | |
if (strlen($_POST['user_name']) < 65 && strlen($_POST['user_name']) > 1) { |
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
echo "foo\nbar\nbaz\nfoo\nbar\nbaz" | ruby -pe 'BEGIN{i=0}; $_.chomp! << "\t" unless (i += 1) % 3 == 0' | |
# Input: | |
# | |
# foo | |
# bar | |
# baz | |
# foo | |
# bar | |
# baz |
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
** Invoke spec (first_time) | |
** Invoke vendor_orgmode (first_time) | |
** Invoke /Users/rob/src/quarto/vendor/org/lisp (first_time, not_needed) | |
** Invoke vendor/org-8.0.7 (first_time, not_needed) | |
** Invoke vendor/org-8.0.7.tar.gz (first_time, not_needed) | |
** Invoke vendor (first_time, not_needed) | |
** Execute vendor_orgmode | |
** Execute spec | |
/Users/rob/.rvm/rubies/ruby-2.0.0-p247/bin/ruby -S rspec ./spec/quarto/build_spec.rb ./spec/quarto/pandoc_epub_spec.rb ./spec/tasks/codex_spec.rb ./spec/tasks/export_spec.rb ./spec/tasks/highlight_spec.rb ./spec/tasks/master_spec.rb ./spec/tasks/sections_spec.rb ./spec/tasks/skeleton_spec.rb -t ~org | |
Run options: exclude {:org=>true} |
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
ruby -e 'p ",\x05\x14\x14\x1DD&\r\x16\x10\f\x00\x05\x1DD#\x11\x1D".chars.map{|x|(x.unpack("C")[0]^100).chr}.join' |
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
highlight TechWordsToAvoid ctermbg=red ctermfg=white | |
function MatchTechWordsToAvoid() | |
match TechWordsToAvoid /\c\<\(obviously\|basically\|simply\|of\scourse\|clearly\|just\|everyone\sknows\|however\|so,\|easy\)\>/ | |
endfunction | |
autocmd FileType markdown call MatchTechWordsToAvoid() | |
autocmd BufWinEnter *.md call MatchTechWordsToAvoid() | |
autocmd InsertEnter *.md call MatchTechWordsToAvoid() | |
autocmd InsertLeave *.md call MatchTechWordsToAvoid() | |
autocmd BufWinLeave *.md call clearmatches() |
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
# requires sponge, from joey hess's moreutils | |
# http://joeyh.name/code/moreutils/ | |
for i in *.txt; do; echo "line to prepend\n" "$(cat $i)" | sponge $i; done |
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
words = %w{foo bar baz} | |
n = 10 | |
# If we use sample, we get a random order but never | |
# more than 3 entries: | |
words.sample(n) | |
# => ["bar", "foo", "baz"] | |
# A solution: | |
n.times.map { words.sample } |
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
def method_a | |
method_b do |thing| | |
thing = 'hey' | |
end | |
end | |
def method_b | |
thing = nil | |
thing = yield thing |
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
#!/usr/bin/env ruby | |
require 'av_capture' | |
require 'pathname' | |
session = AVCapture::Session.new | |
dev = AVCapture.devices.find(&:video?) | |
dir = Pathname(File.expand_path("~/Pictures/av")) | |
Dir.mkdir(dir) unless dir.exist? |
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 "benchmark" | |
def letters | |
puts "letters() called" | |
sleep 0.5 | |
"A-Za-z" | |
end | |
words = %w[the quick brown fox jumped over the lazy dog] |