|- ! Width | chain width:: |-
#include "boost/date_time/posix_time/posix_time.hpp" | |
#include <iostream> | |
#include <sstream> | |
std::string FormatTime(boost::posix_time::ptime now) | |
{ | |
using namespace boost::posix_time; | |
static std::locale loc(std::wcout.getloc(), | |
new wtime_facet(L"%Y%m%d_%H%M%S")); |
# Remove duplicate photos from Aperture masters | |
ls 2014/12/*/*\ \([12]\)* | while read dup; do orig=`echo $dup | sed -e 's/ (1)//'`; duorig=`du $orig | cut -f1`; dudup=`du $dup | cut -f1`; if (( dudup == duorig )); then echo $dup; rm $dup; fi; done | |
# Concatenate with given delimiter | |
ls -1 | tr "\\n" "," | |
# Find bad symlinks | |
find /target/dir -type l ! -exec test -e {} \; -print | |
# Use full line of grep results |
#include <iostream> | |
#include <boost/filesystem.hpp> | |
#include <boost/filesystem/path.hpp> | |
#include <boost/filesystem/fstream.hpp> | |
namespace bf = boost::filesystem; | |
int open_ostream(bf::ofstream &t_stream, bf::path t_path, std::ios_base::openmode t_mode) { | |
t_stream.open(t_path, t_mode); | |
if (!t_stream.is_open()) { |
#include <iostream> | |
#include <boost/filesystem.hpp> | |
#include <boost/filesystem/path.hpp> | |
#include <boost/filesystem/fstream.hpp> | |
namespace bf = boost::filesystem; | |
int open_ostream(bf::ofstream &t_stream, bf::path t_path, std::ios_base::openmode t_mode) { | |
t_stream.open(t_path, t_mode); | |
if (!t_stream.is_open()) { |
# Grouping, case insensitive | |
SELECT lower("subjects"."name_last"), lower("subjects"."name_first"), lower("subjects"."history") FROM "subjects" GROUP BY lower(subjects.name_last), lower(name_first), lower(history) HAVING count(*) > 1; | |
# Another way | |
select name_last, name_first, history | |
from subjects | |
where (upper(name_last), upper(name_first), upper(history)) in | |
(select upper(name_last), upper(name_first), upper(history) | |
from subjects | |
group by upper(name_last), upper(name_first), upper(history) |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
|- ! Width | chain width:: |-
<?php | |
/** | |
* LDAP PHP Change Password Webpage | |
* @author: Matt Rude <http://mattrude.com> | |
* @website: http://technology.mattrude.com/2010/11/ldap-php-change-password-webpage/ | |
* | |
* | |
* GNU GENERAL PUBLIC LICENSE | |
* Version 2, June 1991 |