Skip to content

Instantly share code, notes, and snippets.

@mhartington
mhartington / CustomTheme
Last active December 8, 2018 20:35
If you want to make a custom theme for ionic, and are using scss, this is a base to get you started
//Custom Theme test
// Colors
// -------------------------------
$custom: #057b6c !default;
// Buttons
// -------------------------------
$button-custom-bg: $custom !default;
@mhartington
mhartington / gist:07c529ed839e5265263f
Last active August 29, 2015 14:10
Emmet.vim function
" Remapping <C-y>, just doesn't cut it.
" This is a bit better and works for
" angular directives or web components
function! s:expand_html_tab()
" try to determine if we're within quotes or tags.
" if so, assume we're in an emmet fill area.
let line = getline('.')
if col('.') < len(line)
let line = matchstr(line, '[">][^<"]*\%'.col('.').'c[^>"]*[<"]')
@mhartington
mhartington / git-conventions.md
Last active December 10, 2021 17:40
Git Conventions

You've been working locally for awhile. You're ready to push some changes, but someone else pushed something! You have to pull in their changes before you can push yours.

git pull origin master forces you to create a merge commit, which is annoying.

Instead, do git pull --rebase origin master. This will effectively:

  1. Stash your changes
  2. Pull in the changes from origin
  3. Apply your changes on top

No merge commit!

@mhartington
mhartington / ghUpdate.bash
Created January 28, 2015 16:03
Alias to update a forked repo with the original. One for zsh and one for bash
#!/usr/bin/env bash
function ghUpdate() {
read -p "Whats the URl of the original repo? | " answer
# Add the remote, call it "upstream":
echo $answer
git remote add upstream $answer
# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:
@mhartington
mhartington / index.md
Last active March 15, 2016 02:09
Dynamic app intro for Ionic

#Dynamic app intro for Ionic

Problem

I want to show an app introduction on the first time my users open the app

Solution

Lets create a IntroCtrl

.platform-android4_1 {
/*Any styles for android 4.1*/
}
.platform-android4_3 {
/*Any styles for android 4.3*/
}
.platform-android4_4 {
/*Any styles for android 4.4*/
This file has been truncated, but you can view the full file.
2001 silly mapToRegistry name array-union
2002 silly mapToRegistry using default registry
2003 silly mapToRegistry registry https://registry.npmjs.org/
2004 silly mapToRegistry uri https://registry.npmjs.org/array-union
2005 verbose addNameRange registry:https://registry.npmjs.org/array-union already in flight; waiting
2006 http 304 https://registry.npmjs.org/minimist
2007 silly get cb [ 304,
2007 silly get { date: 'Thu, 09 Apr 2015 22:00:46 GMT',
2007 silly get server: 'Apache',
2007 silly get via: '1.1 varnish',
/Users/mhartington/.config/tmux-status.conf:30: invalid or unknown command: set-window-option -qg window-status-format "#[fg=colour18 bg=colour18] | #[fg=white, bg=colour18] #I | ${PWD##/*/} #[fg=colour18, bg=colour18] | "                                                                                                                                             [0/0]
/Users/mhartington/.config/tmux-status.conf:31: invalid or unknown command: set-window-option -qg window-status-current-format "#[fg=colour18, bg=blue] | #[fg=white, bg=blue] #I |  ${PWD##/*/} #[fg=blue, bg=colour18] | "
@mhartington
mhartington / canDrag.js
Created April 22, 2015 00:20
Dynamically allow ion-items dragging
angular.module('canDragDirective', [ionic])
.directive('isPurchased', function($timeout, $ionicListDelegate) {
return {
restrict: 'A',
link: function($scope, $element) {
$timeout(function() {
var elm = $element[0];
ionic.on('touch', function() {
// Simple way to check if the item is already purchased
@mhartington
mhartington / index.md
Created May 10, 2015 22:09
Fast search with ctrlP and vim
  • install the silver searcher
brew install the_silver_searcher
  • Add this to your .vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""