This file contains hidden or 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
" | |
For a workspace (aka playground) | |
Works in a Moose 6.0 image | |
dcorking, 2017, public domain Creative Commons CC0 | |
" | |
path := '/Users/dcorking/workspace/tmdb-ruby-play/nodes.csv'. | |
stream := FileStream readOnlyFileNamed: path. | |
string := stream contents. |
This file contains hidden or 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
# preview the most recently modified file in the current directory | |
ls -t |head -n 1 | xargs less # sadly less drops out on SIGINT |
This file contains hidden or 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
# debug log using DEBUG=true EXCON_DEBUG=true rails s | |
Started PATCH "/admin/merchants/4/upload_logo?method=patch" for 127.0.0.1 at 2016-02-10 17:01:10 +0000 | |
Processing by Admin::MerchantsController#upload_logo as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"Q6nXffNuL6KD368vHXTrTy5lPzV5udMD458mD3lMxAfdXxOcu5HcP9eL7o0J2AymKmA/sGQZUseLtpHsurBA8g==", "merchant"=>{"logo"=>#<ActionDispatch::Http::UploadedFile:0x00563ccc7ac6c8 @tempfile=#<Tempfile:/tmp/RackMultipart20160210-2362-17es9tm.jpeg>, @original_filename="demo-logo500px.jpeg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"merchant[logo]\"; filename=\"demo-logo500px.jpeg\"\r\nContent-Type: image/jpeg\r\n">}, "method"=>"patch", "id"=>"4"} | |
AdminUser Load (1.3ms) SELECT `admin_users`.* FROM `admin_users` WHERE `admin_users`.`id` = 18 ORDER BY `admin_users`.`id` ASC LIMIT 1 | |
Merchant Load (1.2ms) SELECT `merchants`.* FROM `merchants` WHERE `merchants`.`id` = 4 LIMIT 1 | |
(0.4ms) BEGIN | |
CACHE (0.1ms) SELECT ` |
This file contains hidden or 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
<% # Metronic theme alert classes can be used to style Rails 4 flash messages, for example like this. Render this partial from a page layout or page body. %> | |
<% if flash.any? %> | |
<div class="alerts"> | |
<% user_facing_flashes.each do |key, value| -%> | |
<% # translate flash key to metronic alert class %> | |
<% # http://www.keenthemes.com/preview/metronic/theme/admin_1/ui_alerts_api.html %> | |
<% alert_class = {'alert' => 'alert-warning', 'notice' => 'alert-info'}[key] %> | |
<div class="alert <%= alert_class %>"><%= value %></div> | |
<% end -%> |
This file contains hidden or 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
################################################################### | |
### vagrant_1.5.4_x86_64.rpm | |
################################################################### | |
david1@localhost:~$ cd ~/workspace/24pullrequests/ | |
david1@localhost:~/workspace/24pullrequests (master)$ vagrant up | |
Bringing machine 'default' up with 'virtualbox' provider... | |
==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install... | |
default: Box Provider: virtualbox | |
default: Box Version: >= 0 |
This file contains hidden or 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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <limits.h> | |
/* implements http://stackoverflow.com/questions/25079788/typecasting-int-to-char-in-printf-in-c */ | |
/* by discussedtree */ | |
/* Output is */ | |
/* Int size in bits is: 32 */ | |
/* Without typecasting, the integer at byte #0 is set to: 53200 */ |
This file contains hidden or 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
Error: RemoteString past end of file | |
1 August 2014 9:03:34.854 am | |
VM: unix - Smalltalk | |
Image: Squeak4.5 [latest update: #13687] | |
SecurityManager state: | |
Restricted: false | |
FileAccess: true | |
SocketAccess: true |
This file contains hidden or 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/ruby | |
# Inspired by http://innig.net/software/ruby/closures-in-ruby | |
# Can this take 2 blocks? | |
# def apply_two_things(&block1, arg_after_block) | |
# end | |
# syntax error, unexpected ',', expecting ')' | |
# What about 2 procs? |
This file contains hidden or 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
# This is not the official way to prune directories, but I found it easier. | |
# It prints the contents of all the files in the tree - excluding .git and CachedPixmaps, | |
# but there is a potential bug in the second globbed file name | |
# | |
# Works with GNU findutils. Might not work with BSD find, such as Mac OS X. | |
find -not -wholename './.git*' -not -wholename '*CachedPixmaps*' -type f |xargs cat |
This file contains hidden or 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
(5..20).each {|i| v = VolunteerOp.create :title => 'Voluntary helper', :description => 'Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volu |