Skip to content

Instantly share code, notes, and snippets.

private static DialogResponse showDialog(DialogTemplate template) {
try {
final FXDialog dialog = template.getDialog();
Window window = dialog.getOwner();
// get center of window
final double windowCenterX = window.getX() + (window.getWidth() / 2);
final double windowCenterY = window.getY() + (window.getHeight() / 2);
@Skinner927
Skinner927 / splitButtonDropdowns.js
Last active August 29, 2015 14:00
Replaces the Bootstrap Split Button Dropdowns js
// Replaces the Bootstrap Split Button Dropdowns js
// Works automatically
// http://getbootstrap.com/components/#btn-dropdowns
angular.module('splitButtonDropdowns', [])
.directive('dropdownToggle', ['$timeout', function($timeout){
return {
restrict: 'C',
link: function(scope, element, attrs) {
element.on('click', function(){
@Skinner927
Skinner927 / dialogs.js
Created May 29, 2014 14:52
Angular Overhead Alert Dialog
angular.module('dialogs',[])
.factory('alerts', ['$document', '$timeout', function($document, $timeout){
return {
/* Pops an alert to the top of the page. Be careful, they will stack on each other if called often (use the callback for chains)
* @param html HTML to display in the alert
* @param delay (optional) time in ms to display the alert for
* @param cssClass (optional) Bootstrap css alert- class (alert-success, alert-info, etc.) or a class that models off of it.
* @param callback (optional) Function to call once the alert is no longer displayed
*/
slideAlert : function(html, delay, cssClass, callback) {
@Skinner927
Skinner927 / routerStateEq.js
Last active August 29, 2015 14:05
Angular Directive that analyses the current ui-router $state and allows us to apply a css class depending on true/false
'use strict';
/**
* router-state-eq Directive
*
* What does this directive do?
* Analyses the current $state and allows us to apply a css class depending on true/false
*
* How to use it?
* Apply the router-state-eq="" attribute to the DOM element you want to style
@Skinner927
Skinner927 / giveFocusTo
Created October 10, 2014 21:37
AngularJs Directive - Give Focus To
.directive('giveFocusTo', ['$timeout', function($timeout){
return {
restrict: 'A',
link: function(scope, el, attrs){
el.on('click', function(e){
if(e.preventDefault === 'function'){
e.preventDefault();
}
var id = '#'+attrs.giveFocusTo;
var ele = angular.element(id);
@Skinner927
Skinner927 / automount.conf
Created October 27, 2014 14:34
Upstart job for sshfs
start on (local-filesystems and net-device-up IFACE!=lo)
task
script
echo "start on: $(date)" > /home/user/automount_log.txt
while true; do ping -c1 172.16.76.50 &> /dev/null && break; done
sshfs -o allow_other,uid=$(id -u),gid=$(id -g),delay_connect [email protected]:user/git/website-user/ /var/www/website_user >> /home/user/automount_log.txt 2>&1
echo "end on: $(date)" >> /home/user/automount_log.txt
end script
@Skinner927
Skinner927 / private.xml
Created December 29, 2014 19:19
Karabiner - Fast Arrow Cursor Key Repeat
<?xml version="1.0" ?>
<root>
<replacementdef>
<replacementname>LowKeyRepeat</replacementname>
<replacementvalue>KeyRepeat::RawValue::20</replacementvalue>
</replacementdef>
<item>
<identifier>com.denniskinner.fastArrowKeys</identifier>
<name>Fast Arrow Keys</name>
<appendix>Arrow keys repeat every 20ms</appendix>
@Skinner927
Skinner927 / private.xml
Created January 20, 2015 18:25
Karabiner private.xml
<?xml version="1.0" ?>
<root>
<item>
<name>! Custom</name>
<replacementdef>
<replacementname>LowKeyRepeat</replacementname>
<replacementvalue>KeyRepeat::RawValue::20</replacementvalue>
</replacementdef>
<item>
@Skinner927
Skinner927 / chrome.di.fm.app
Created May 27, 2015 17:30
DI.fm Digitally Imported open in resized Chrome window
tell application "Google Chrome"
if it is running then
make new window
else
activate
end if
open location "http://di.fm"
set the bounds of the front window to {0, 0, 550, 800}
end tell
@Skinner927
Skinner927 / ir_black.itermcolors
Created December 7, 2015 17:16
ir_black theme for iterm2. Ensure to go to Preferences->Profiles->Text and change the "Draw bold text in bright colors" setting off.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.31090480089187622</real>
<key>Green Component</key>
<real>0.31097450852394104</real>