Skip to content

Instantly share code, notes, and snippets.

View pcnate's full-sized avatar

Nathan Baker pcnate

View GitHub Profile
//---------------------------------------------------------------------------------------------------------------------------------------------------
// directive to allow item to scroll with top of page or stay where it belongs
.directive( 'floatingAlert', function( $document, $window ) {
return {
restrict: 'A',
link: function($scope, $element) {
$document.bind('scroll', function() {
var docViewTop = $window.pageYOffset;
var docViewBottom = docViewTop + $window.innerHeight;
<div class="col-xs-12"> <!-- floating alerts -->
<div class="row">
<div class="col-xs-12">
<div class="row" floating-alert> <!-- alert row -->
<div ng-cloak ng-repeat="alert in alerts.alerts track by $index">
<div ng-if="alert.floating == 'true'" class='col-xs-12 col-sm-12 col-md-12 col-lg-12'>
<div class='alert' ng-class="[ alert['type'] ]" role='alert'>
<button type='button' class='close' ng-click="alerts.close( $index, 'index' )" aria-label='Close'><span aria-hidden='true'>&times;</span></button>
<strong><i class="fa" ng-class="[ alert['icon'] ]"></i>&nbsp;{{ alert.message }}</strong>
</div>
@pcnate
pcnate / gist:e299709dc19c6b681993
Created June 15, 2015 17:04
remove all items in download tab that have been removed
$(".status:contains('Removed')")
.closest("div.download")
.find("a.remove").click()
'atom-workspace atom-text-editor:not([mini])':
'ctrl-shift-down': 'editor:move-line-down'
'ctrl-shift-up': 'editor:move-line-up'
# requires https://atom.io/packages/multi-cursor
'atom-workspace atom-text-editor:not([mini])':
# you may have to unset the keybinding if it's already in use.
# Expand current cursor
'alt-shift-down': 'multi-cursor:expandDown'
'body':
'ctrl-shift-pagedown': 'pane:move-item-right'
'ctrl-shift-pageup': 'pane:move-item-left'
#Returns the sum of num1 and num2#
def add(num1, num2):
return num1 + num2
def sub(num1, num2):
return num1 - num2
def mul(num1, num2):
return num1 * num2
@pcnate
pcnate / apt-get output
Last active August 7, 2018 00:53
system76-driver 20180802
pcnate@pop-os:~$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
apt-config-icons apt-config-icons-hidpi apt-config-icons-large
apt-config-icons-large-hidpi
The following packages will be upgraded:
amd64-microcode atom gnome-shell-extension-pop-battery-icon-fix google-chrome-stable
@pcnate
pcnate / keymaps
Created August 21, 2018 13:40
hyper.is keymaps
keymaps: {
"tab:next": "ctrl+pageup",
"tab:prev": "ctrl+pagedown",
"pane:next": "ctrl+tab",
"pane:prev": "ctrl+shift+tab"
},
@pcnate
pcnate / speed test
Created December 5, 2018 19:07
flatten an array of objects with a property that contains an array
const arr = [
{ sub: [ 1001, 1002, 1003, 1004, 1005 ] },
{ sub: [ 2001, 2002, 2003, 2004, 2005 ] },
{ sub: [ 3001, 3002, 3003, 3004, 3005 ] },
{ sub: [ 4001, 4002, 4003, 4004, 4005 ] },
{ sub: [ 5001, 5002, 5003, 5004, 5005 ] },
];
const startDates = [];
@pcnate
pcnate / app.module.ts
Last active February 10, 2019 21:05
basic socket service for angular 6 and 7
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { SocketService } from './_services';
@NgModule({
declarations: [],
imports: [
BrowserModule,