Skip to content

Instantly share code, notes, and snippets.

View danmartens's full-sized avatar
✌️

Dan Martens danmartens

✌️
View GitHub Profile
@danmartens
danmartens / App.js
Last active July 8, 2019 13:43
Urban Airship/Gimbal Android Integration
import * as React from 'react';
import { UrbanAirship } from 'urbanairship-react-native';
class App extends React.Component {
componentDidMount() {
UrbanAirship.setUserNotificationsEnabled(true);
UrbanAirship.setLocationEnabled(true);
}
render() {
@danmartens
danmartens / deepTransformKeys.js
Created September 29, 2017 14:02
Deep transforms keys in Objects and Arrays
// @flow
import { isObject, isArray, reduce, map } from 'lodash';
function deepTransformKeys<T>(transformKey: string => string, object: T): T {
if (isObject(object)) {
return reduce(
object,
(reduction, value, key) => {
reduction[transformKey(key)] = deepTransformKeys(transformKey, value);
@danmartens
danmartens / atom-ignored-names.txt
Last active October 5, 2017 18:08
Atom Ignored Names
.git, .hg, .svn, .DS_Store, ._*, Thumbs.db, desktop.ini, tmp, tmp/*, */tmp/*, node_modules, node_modules/*, */node_modules/*, log/*, *.map, coverage, coverage/*, public/assets, public/assets/*, .byebug_history, *.svg, *.jpg, *.jpeg, *.png, *.gif, **/dist/**

Keybase proof

I hereby claim:

  • I am danmartens on github.
  • I am danmartens (https://keybase.io/danmartens) on keybase.
  • I have a public key ASCCcOFSD0pN4nKOuDvCi3UVZ_OufMGMFMY2NIcZaQuj_wo

To claim this, I am signing this object:

@danmartens
danmartens / module-class.js
Last active June 29, 2017 01:00
Redux Operations
import type { CurrentUserState } from './types';
import createSession from './create-session';
import destroySession from './destroy-session';
import updatePassword from './update-password';
class CurrentUser extends OperationsModule {
static key = 'currentUser';
static initialState: CurrentUserState = {
email: null,
alias rc='bin/rails console'
alias rdbc='bin/rails dbconsole'
alias rg='bin/rails generate'
alias rgm='bin/rails generate migration'
alias rgc='bin/rails generate controller'
alias rs='bin/rails server'
alias rcc='bin/rails runner Rails.cache.clear'
alias devlog='tail -f log/development.log'
alias rdbm='bin/rake db:migrate'
alias rdbms='bin/rake db:migrate:status'
@danmartens
danmartens / click_outside_mixin.js
Created September 17, 2014 13:27
Ember ClickOutside Mixin
var ClickOutside = Ember.Mixin.create({
listenForClickOutside: false,
clickOutside: Ember.K,
_delegateClickOutside: function() {
$(window).on('mousedown', $.proxy(this._handleClickOutside, this));
},
@danmartens
danmartens / foreman.plugin.zsh
Created August 21, 2014 19:16
Foreman ZSH Plugin
fs() {
if (( $# == 1 )); then
cd ~/Projects/$1;
fi
if ls 'Procfile.local' &> /dev/null; then
local procfile='Procfile.local'
echo "Starting foreman with Procfile.local...";
else
local procfile='Procfile'
@danmartens
danmartens / livereload_helper.rb
Created August 13, 2014 16:36
Rails Livereload Helper
module LivereloadHelper
def livereload_script_tag
ip = Socket.ip_address_list.detect { |intf| intf.ipv4_private? }
ip ? content_tag(:script, nil, src: "http://#{ip.ip_address}:35729/livereload.js?snipver=1") : ''
end
end
@danmartens
danmartens / truncate.js
Last active August 29, 2015 14:05
AngularJS Truncate Directive
/**
* @example
* <p tuncate max-lines="3">
* 8-bit street art brunch YOLO, crucifix PBR Banksy.
* Direct trade Bushwick art party letterpress, Cosby
* sweater selvage plaid pop-up forage meh you
* probably haven't heard of them. Food truck
* 90's sartorial locavore ugh seitan,
* shabby chic cardigan artisan.
* </p>