Skip to content

Instantly share code, notes, and snippets.

View jlgerber's full-sized avatar

jlgerber

View GitHub Profile
@jlgerber
jlgerber / git_cmds.sh
Last active December 21, 2016 08:03
git commands
git log --oneline --graph --all --decorate # print the log, one line per commit, show a graph, for all branches, and decorate with the name of the branch
You can go ahead and create an alias for this or any command
git config --global alias.logv 'log --oneline --graph --all --decorate'
This is stored in ~/.gitconfig under [alias]
--------------
If you want the status of your local repo to be reflected in your prompt, you can make use of the following project:
https://github.com/djl/vcprompt
@jlgerber
jlgerber / neonAnimationBehavior.js
Last active December 21, 2016 08:03
custom neon animation behavior...not working
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/neon-animation/neon-animation-behavior.html">
<!-- <link rel="import" href="../../bower_components/web-animations-js/web-animations.html"> -->
/*
grow-width-animation
config: {
node:<the node to operate on>
width: <string> the width in pixels to end on.
}
#![feature(custom_derive, plugin)]
#![feature(custom_attribute)]
#![plugin(serde_macros)]
extern crate serde;
extern crate serde_json;
use serde::ser::Serializer;
fn main() {
@jlgerber
jlgerber / CMakeLists.txt
Last active December 14, 2023 07:52
cmake - handling executable and library with same name
# Lets say we want to add a library and an executable, both with the same name.
# In this example, it is resman
add_library(resman ${src_cpps} ${src_hpps} )
target_link_libraries(resman ${Boost_LIBRARIES} ${LIBYAML} ${LIBFMT})
#
# Add resman executable
#
# We call the executable resman-bin
add_executable(resman-bin main.cpp )
@jlgerber
jlgerber / CMakeLists.txt
Last active December 31, 2016 23:44
cmake - ad hoc locating of external library and includes. EG libyaml-cpp.a
#
# FIND libyaml-cpp.a
#
find_library(LIBYAML libyaml-cpp.a)
find_path(LIBYAML_INC yaml-cpp/yaml.h)
if(NOT LIBYAML)
# FATAL_ERROR will fail the CMakeLists.txt processing
message(FATAL_ERROR "Unable to find libyaml")
endif()
if(NOT LIBYAML_INC)
@jlgerber
jlgerber / CMakeLists.txt
Created December 31, 2016 23:47
cmake - specify location where executables and libraries get built
# I like putting artifacts in a private directory in the build tree. Here is how i do it
# define where executable products go
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/private/bin)
# define where library products go
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/private/lib)
@jlgerber
jlgerber / FindMaya.cmake
Last active January 5, 2017 15:49
cmake - custom FindMaya.cmake plugin
# adapted from Chad Vernon's wonderful video series
# only tested on OSX so far
# to use, set the CMAKE_MODULE_PATH to point at this file.
# CACHE keyword allows us to pass in from the command line
if(NOT DEFINED MAYA_VERSION)
set(MAYA_VERSION 2017 CACHE STRING "Maya version")
endif()
set(MAYA_COMPILE_DEFINITIONS "REQUIRE_IOSTREAM;_BOOL")
# from http://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit
git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
@jlgerber
jlgerber / stack_and_recursion.rs
Created May 5, 2018 17:11
rust stack vs recursion
static STUFF: &'static [&'static str] = &[
"foo",
"bar",
"bla",
"crar",
"mala",
"court",
"dupla",
"fooobas",
"lalalala",
@jlgerber
jlgerber / rust_any_traitobj.rs
Created May 6, 2018 14:28
getting around inability to use PartialEq and PartialOrd with trait objects. from https://users.rust-lang.org/t/testing-equality-with-a-trait-object/5034/6
use std::any::Any;
trait Schema {
fn eq(&self, other: &Schema) -> bool;
fn as_any(&self) -> &Any;
}
impl<'a, 'b> PartialEq<Schema+'b> for Schema+'a {
fn eq(&self, other: &(Schema+'b)) -> bool {
Schema::eq(self, other)