Skip to content

Instantly share code, notes, and snippets.

View cotto's full-sized avatar

Charis Otto cotto

  • Seattle
  • 06:00 (UTC -08:00)
View GitHub Profile
<?php
# originally for use in includes/bootstrap.php in Drupal but intentionally self-contained and suitable for any PHP project
# uses /**/ comments so that it can be squished into a single line for easy copy/pasting
/* intended use: l("debug message"); l(array('foo', $random_object));
/* l() was already taken */
function ll($logged_thing, $no_backtrace = false) {
static $req_id = 0;
alias cg='valgrind --tool=callgrind --dump-instr=yes --collect-jumps=yes'
alias chromium='chromium-browser'
alias chromium_fkill='ps aux|grep flash|grep chromium|sed -e "s/cotto[ ]*//" -e "s/ .*//"|xargs kill'
alias clr='colordiff|less -r'
alias clr='colordiff|less -R'
alias d='dbus-send --session /net/sf/roxterm/Options net.sf.roxterm.Options.SetColourScheme string:$ROXTERM_ID string:Default'
alias ddt='dbfdump --table'
alias firefox_fkill='ps aux|grep flash|grep firefox|sed -e "s/cotto[ ]*//" -e "s/ .*//"|xargs kill'
alias gai="git add -i"
alias gall='git log --patience -p|colordiff -lr|less -R'
@cotto
cotto / gist:dbb1234be91196ba0362
Created July 5, 2014 01:08
auto update the mayday.us counter
function u(){jQuery.getJSON('https://pledge.mayday.us/r/total', function(data) {updateTotal(data.totalCents);}); setTimeout(u,5000) }; u();
@cotto
cotto / gist:5025496
Created February 24, 2013 20:33
use shallow clones for gen-parrot
diff --git a/tools/lib/NQP/Configure.pm b/tools/lib/NQP/Configure.pm
index ac397e1..1d6e7d1 100644
--- a/tools/lib/NQP/Configure.pm
+++ b/tools/lib/NQP/Configure.pm
@@ -203,20 +203,14 @@ sub git_checkout {
# get an up-to-date repository
if (! -d $dir) {
- system_or_die('git', 'clone', $repo, $dir);
+ system_or_die('git', 'clone', '--depth', '1', '--branch', $checkout, $repo, $dir);
@cotto
cotto / gist:5020729
Last active December 14, 2015 03:28
diff --git a/include/parrot/io.h b/include/parrot/io.h
index 42b9f44..9fdfd2f 100644
--- a/include/parrot/io.h
+++ b/include/parrot/io.h
@@ -63,6 +63,8 @@
#define PIO_VF_AWAYS_READABLE 0x0010 /* Handle can always be read */
#define PIO_VF_MULTI_READABLE 0x0020 /* Can perform multiple low-level read
operations to satisfy a large request */
+#define PIO_VF_SYNC_IO 0x0040 /* This type needs synchronization
+ before r/w operations */
@cotto
cotto / gist:4951406
Last active December 13, 2015 17:58
blog post draft
It's been quiet. Too quiet.
Interest in Parrot has waned over the past 18 months. The most recent flurry
of activity happened when Allison Randal brought up the fact that The Parrot
Foundation was in shambles and suggested shutting it down. This naturally
brought up the state of Parrot itself and what the future holds for it, if
anything. The situation is perhaps less than ideal. The short answer is that
Parrot's immediate prospects are iffy at best, but there is at least one niche
where Parrot still has a chance to shine.
@cotto
cotto / gist:4108633
Created November 19, 2012 02:21
rakudo spectest failures with parrot master
Test Summary Report
-------------------
t/spec/S02-lexical-conventions/comments.rakudo (Wstat: 0 Tests: 50 Failed: 1)
Failed test: 3
t/spec/S02-literals/quoting.rakudo (Wstat: 256 Tests: 0 Failed: 0)
Non-zero exit status: 1
Parse errors: No plan found in TAP output
t/spec/S02-types/bool.t (Wstat: 134 Tests: 50 Failed: 0)
Non-zero wait status: 134
Parse errors: Bad plan. You planned 51 tests but ran 50.
@cotto
cotto / gist:4108166
Created November 18, 2012 23:37
rakudo test failures on parrot threads branch
Test Summary Report
-------------------
t/spec/S02-lexical-conventions/comments.rakudo (Wstat: 0 Tests: 50 Failed: 1)
Failed test: 3
t/spec/S02-literals/quoting.rakudo (Wstat: 256 Tests: 0 Failed: 0)
Non-zero exit status: 1
Parse errors: No plan found in TAP output
t/spec/S02-types/bool.t (Wstat: 134 Tests: 50 Failed: 0)
Non-zero wait status: 134
Parse errors: Bad plan. You planned 51 tests but ran 50.
@cotto
cotto / uuid.entity.php
Created September 8, 2012 07:19
spot the bug
/**
* Implements of hook_entity_property_info_alter().
*
* This adds the UUID as an entity property for all UUID-enabled entities
* which automatically gives us token and Rules integration.
*/
function uuid_entity_property_info_alter(&$info) {
foreach (entity_get_info() as $entity_type => $info) {
if (isset($info['uuid']) && $info['uuid'] == TRUE && !empty($info['entity keys']['uuid'])) {
$info[$entity_type]['properties'][$info['entity keys']['uuid']] = array(
@cotto
cotto / hash.rb
Created July 23, 2012 19:25
so, this seems to work
cotto@quill:/usr/src/ruby-exp 1 $ cat hash.rb
map = {}
map[1234] = "value of 1234"
x = map[1234];
puts x
cotto@quill:/usr/src/ruby-exp 1 $ ruby hash.rb
value of 1234