Skip to content

Instantly share code, notes, and snippets.

@awinograd
awinograd / gist:2493797
Created Apr 25, 2012
EE47 Lab 3 - Analog Input Code
View gist:2493797
/*
Analog Input
Demonstrates analog input by reading an analog sensor on analog pin 0 and
turning on and off a light emitting diode(LED) connected to digital pin 13.
The amount of time the LED will be on and off depends on
the value obtained by analogRead().
The circuit:
* Potentiometer attached to analog input 0
* center pin of the potentiometer to the analog pin
View gist:bba4d77d85afc7c93273e32bfa165e85
Reading symbols from /home/awinograd/hhvm314/usr/local/bin/hhvm...done.
[New LWP 10100]
[New LWP 17575]
[New LWP 10014]
[New LWP 9035]
[New LWP 10101]
[New LWP 10099]
[New LWP 8674]
[New LWP 9038]
View gist:7b33347e2d8efc49cf5ab4a98263c8b0
$1 = {<HPHP::AtomicCountable> = {m_count = {<std::__atomic_base<int>> = {_M_i = 0}, <No data fields>}}, static MethodCreateHook = 0x0, m_nextClass = {m_s = 0}, m_extra = {
m_p = 0x962d060 <HPHP::default_ptr<HPHP::Class::ExtraData>::s_default>, static s_default = {m_traitAliases = std::vector of length 0, capacity 0,
m_usedTraits = std::vector of length 0, capacity 0, m_traitsBeginIdx = 0, m_traitsEndIdx = 0, m_instanceCtor = {m_s = 0}, m_instanceDtor = {m_s = 0},
m_builtinODTailSize = 0,
m_scopedClones = {<std::unordered_map<unsigned long, HPHP::AtomicSharedPtrImpl<HPHP::Class, true>, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<std::pair<unsigned long const, HPHP::AtomicSharedPtrImpl<HPHP::Class, true> > > >> = std::unordered_map with 0 elements, <No data fields>}, m_nativeDataInfo = 0x0}}, m_requirements = {
m_map = {m_mask = 0, m_extra = 0, m_table = 0x0}}, m_declInterfaces = std::unique_ptr<HPHP::AtomicSharedPtrImpl<HPHP::Class, true>> containing 0x0,
View gist:72c1b6d09c777848f9eb975642170673
(gdb) walkstk
#0 {inline frame} @ 0x7f6c0368c5f7: raise()
#1 {inline frame} @ 0x7f6c0368c5f7: abort()
#2 0x7f6bdabf6430 @ 0x7f6c0368c5f7: HPHP::bt_handler() at /home/awinograd/build_hhvm/hhvm/hphp/runtime/base/crash-reporter.cpp:43
#3 {inline frame} @ 0x7f6c08c48100: __restore_rt()
#4 0x7f6bdabf6a00 @ 0x7f6c08c48100: HPHP::Func::validate() at /home/awinograd/build_hhvm/hhvm/hphp/runtime/vm/func-inl.h:73
#5 0x7f6bdabf6a30 @ 0x056636d7: HPHP::Func::fromFuncId() at /home/awinograd/build_hhvm/hhvm/hphp/runtime/vm/func.cpp:357
#6 0x7f6bdabf6a50 @ 0x05728433: HPHP::SrcKey::func() at /home/awinograd/build_hhvm/hhvm/hphp/runtime/vm/srckey-inl.h:120
#7 0x7f6bdabf6cc0 @ 0x061ad17a: HPHP::jit::TransRec::print() at /home/awinograd/build_hhvm/hhvm/hphp/runtime/vm/jit/trans-rec.cpp:146
#8 0x7f6bdabf6da0 @ 0x05f4f1eb: HPHP::jit::MCGenerator::dumpTCData() at /home/awinograd/build_hhvm/hhvm/hphp/runtime/vm/jit/mc-generator.cpp:2216
@awinograd
awinograd / .vimrc
Last active Apr 16, 2017
vimrc for prettier
View .vimrc
autocmd FileType javascript set formatprg=prettier\ --stdin\ --single-quote\ --trailing-comma\ es5
autocmd FileType javascript.jsx set formatprg=prettier\ --stdin\ --single-quote\ --trailing-comma\ es5
nnoremap <silent> <leader>p gggqG<CR>
" I decided to disable running prettier on save b/c of how
" it loses the cursor position and instead just use `<leader>p` occasionally
" That said, here are the commands I used for auto-prettier on save
" autocmd BufWritePre *.js exe "normal! gggqG\<C-o>\<C-o>"
" autocmd BufWritePre *.jsx exe "normal! gggqG\<C-o>\<C-o>"
@awinograd
awinograd / gist:4699980
Last active Jan 30, 2018
cvim file for opening links from better_error and RailsPanel in vim on ubuntu.
View gist:4699980
#! /usr/bin/env ruby
# Modified from : http://www.tkalin.com/blog_posts/using-console-vim-as-vim-protocol-handler-in-ubuntu
# NOTE: This opens with a link to the mvim protocol for compatibility with RailsPanel
# goes to /usr/local/bin/cvim
require 'uri'
require 'cgi'
full_path = ARGV[0]
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View delegate_matcher.rb
# RSpec matcher to spec delegations.
# Forked from https://gist.github.com/ssimeonov/5942729 with fixes
# for arity + custom prefix.
#
# Usage:
#
# describe Post do
# it { should delegate(:name).to(:author).with_prefix } # post.author_name
# it { should delegate(:name).to(:author).with_prefix(:any) } # post.any_name
# it { should delegate(:month).to(:created_at) }
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions