Skip to content

Instantly share code, notes, and snippets.

R. Kyle Murphy orclev

  • Florida
Block or report user

Report or block orclev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View lifetimes2.rs
pub struct OpenRadioContext<'a, 'b:'a> {
_context: PhantomData<&'b Context>,
usb_context: Box<Context>,
device_handle: DeviceHandle<'a>,
}
impl <'a, 'b> Drop for OpenRadioContext<'a, 'b> {
fn drop(&mut self) {
self.device_handle.release_interface(0).unwrap();
}
View lifetimes.rs
pub struct OpenRadioContext<'a> { // public struct
usb_context: Context, // private fields, safety depends on these not being accessed directly
device_handle: DeviceHandle<'a>,
}
... snip ...
impl <'a> OpenRadioContext<'a> {
fn open() -> OpenRadioContext<'a> {
View gem.hs
import Data.Set as S
import Data.List as L
process :: String -> String
process input =
let lines' = lines input
sets = L.map S.fromList lines'
gemElements = L.foldl1 S.intersection sets
in show $ S.size gemElements
View gem.hs
import Data.Set (fromList, intersection, size)
import Data.List (foldl1, map)
process :: String -> String
process = show . size . foldl1 intersection . map fromList . lines
main :: IO ()
main = interact process
View keybase.md

Keybase proof

I hereby claim:

  • I am orclev on github.
  • I am orclev (https://keybase.io/orclev) on keybase.
  • I have a public key whose fingerprint is 7C7D 9E8A 33E5 AF57 ED0C 701B 53C2 D954 B35B 18BA

To claim this, I am signing this object:

@orclev
orclev / example.md
Last active Aug 29, 2015
Gitflow Examples
View example.md

git flow usage

Start using git flow on a new repo or one you haven't used git flow on before

user@example ~/gitflow-example [master] $ git flow init
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master] 
Branch name for "next release" development: [develop] 

How to name your supporting branch prefixes?
@orclev
orclev / fizzbuzz.hs
Created Nov 30, 2012
FizzBuzz in Haskell
View fizzbuzz.hs
fbshow :: Int -> String
fbshow i | i `mod` 15 == 0 = "FizzBuzz"
| i `mod` 3 == 0 = "Fizz"
| i `mod` 5 == 0 = "Buzz"
| otherwise = show i
main :: IO ()
main = mapM_ (putStrLn . fbshow) [1 .. 100]
View Evolution of a Python programmer.py
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@orclev
orclev / trie.py
Created Feb 29, 2012
Copied from vivekn / autocomplete / trie.py
View trie.py
"""
A fast data structure for searching strings with autocomplete support.
Copied this from https://github.com/vivekn/autocomplete/blob/master/trie.py
so I could embed it as a gist
"""
class Trie(object):
def __init__(self, value=None):
self.children = {}
self.value = value
@orclev
orclev / tst.py
Created Feb 29, 2012
Python TST implementation
View tst.py
# -*- coding: utf-8 -*-
# Copied from https://bitbucket.org/woadwarrior/trie/src/0ca6aab259b2/python/tst.py
_SENTINEL = ()
class TST(object) :
__slots__ = ('splitchar','l','m','r','v')
def __init__( self, ch=None ) :
self.splitchar = ch
You can’t perform that action at this time.