Skip to content

Instantly share code, notes, and snippets.

View lee-dohm's full-sized avatar
😴
Taking some well-deserved naps

Lee Dohm lee-dohm

😴
Taking some well-deserved naps
View GitHub Profile
@lee-dohm
lee-dohm / migration.ex
Last active August 29, 2015 14:25
Migration error
** (MatchError) no match of right hand side value: %{columns: ["count"], command: :select, num_rows: 1, rows: [[0]]}
(ecto) lib/ecto/adapters/postgres.ex:61: Ecto.Adapters.Postgres.ddl_exists?/3
(ecto) lib/ecto/migration/schema_migration.ex:19: Ecto.Migration.SchemaMigration.ensure_schema_migrations_table!/1
(ecto) lib/ecto/migrator.ex:36: Ecto.Migrator.migrated_versions/1
(ecto) lib/ecto/migrator.ex:134: Ecto.Migrator.run/4
(mix) lib/mix/cli.ex:55: Mix.CLI.run_task/2
Process: Atom [68265]
Path: /Applications/Atom.app/Contents/MacOS/Atom
Identifier: com.github.atom
Version: 1.0.3-a791809 (1.0.3-a791809)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Atom [68265]
User ID: 501
Date/Time: 2015-07-17 08:28:29.527 -0700

Repro Steps: Launching from Dock

  1. Close all instances of Atom
  2. Launch Atom from the Dock
  3. Open the developer tools
  4. Enter the command: spawnSync = require('child_process').spawnSync
  5. Enter the command: spawnSync('/bin/zsh', ['--login'], {input: "env"}).stdout.toString()
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
at ICSharpCode.SharpZipLib.Zip.FastZip.ExtractZip(String zipFileName, String targetDirectory, Overwrite overwrite, ConfirmOverwriteDelegate confirmDelegate, String fileFilter, String directoryFilter, Boolean restoreDateTime)
at Squirrel.UpdateManager.ApplyReleasesImpl.<>c__DisplayClass6_0.<<installPackageToAppDir>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Squirrel.Utility.<LogIfThrows>d__33`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
@lee-dohm
lee-dohm / gist:2993650
Created June 26, 2012 06:01
Proper way to handle path arguments in Ruby methods
def callee(arg)
path = arg.path if arg.respond_to?(:path)
path ||= arg.to_path if arg.respond_to?(:to_path)
path ||= arg.to_str if arg.respond_to?(:to_str)
raise "Invalid path `#{arg}`" unless path
# ... do something with path
end
@lee-dohm
lee-dohm / rscript.R
Created July 18, 2012 18:57 — forked from ssimeonov/rscript.R
Rscript discovery & reloading
rscript.stack <- function()
{
# Returns the stack of Rscript files.
#
# Returns:
# Stack of files.
Filter(Negate(is.null), lapply(sys.frames(), function(x) x$ofile))
}
@lee-dohm
lee-dohm / gist:3461122
Created August 25, 2012 05:14
An assembly line in Go
import "fmt"
func main() {
c1 = make(chan string)
c2 = make(chan T)
c3 = make(chan U)
go readStuff(c1)
go parseStuff(c1, c2)
go calculateStuff(c2, c3)
for value := range c4 {
@lee-dohm
lee-dohm / linktastic.css
Created August 25, 2012 20:23 — forked from psyked/linktastic.css
CSS: Automatic link type icons
a[href^="http:"] {
display:inline-block;
padding-right:14px;
background:transparent url(/Images/ExternalLink.gif) center right no-repeat;
}
a[href^="mailto:"] {
display:inline-block;
padding-left:20px;
line-height:18px;
background:transparent url(/Images/MailTo.gif) center left no-repeat;
@lee-dohm
lee-dohm / gist:4103861
Last active October 12, 2015 23:28
License: MIT
The MIT License (MIT)
Copyright © 2013 Lee Dohm, Lifted Studios
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@lee-dohm
lee-dohm / atom-version.rb
Last active November 2, 2015 23:24
Atom and OS Version Text Expander Snippets (for OS X)
#!/usr/bin/env ruby
atom_version = `/usr/local/bin/atom --version`.chomp
print "Atom v#{atom_version}"