Skip to content

Instantly share code, notes, and snippets.

@phplaw
phplaw / killadobe.sh
Created March 30, 2020 15:09 — forked from CyberPunkCodes/killadobe.sh
Mac Bash script to kill Adobe Create Cloud and other processes that Adobe forces on us.
#!/bin/bash
echo "\n\n--- Killing Stupid Adobe Auto Load Crap ---\n\n"
launchctl unload -w /Library/LaunchAgents/com.adobe.AdobeCreativeCloud.plist
launchctl unload -w /Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist
echo "\n\n--- Done! ---\n\n"
@phplaw
phplaw / Activate Office 2019 for macOS VoL.md
Created March 29, 2020 22:07 — forked from zthxxx/Activate Office 2019 for macOS VoL.md
crack activate office on mac with license file

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref

@phplaw
phplaw / doubleclick.js
Created September 10, 2018 22:42 — forked from mauriciosoares/doubleclick.js
rxjs double click example
let clickStream = Rx.Observable.fromEvent(document.getElementById('link'), 'click');
clickStream
.buffer(clickStream.debounce(250))
.map(list => list.length)
.filter(x => x === 2)
.subscribe(() => {
console.log('doubleclick');
})
@phplaw
phplaw / .bash_profile
Created August 21, 2018 03:46 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@phplaw
phplaw / domains.md
Created August 13, 2018 12:33
Node Error Handling and Domains

Node Error Handling and Domains

"Occurrences in this domain are beyond the reach of exact prediction because of the variety of factors in operation, not because of any lack of order in nature." - Albert Einstein

"Master of my domain" - Larry David

Error handling in an asynchronous language works in a unique way and presents many challenges, some unexpected. This tutorial reviews the various error handling patterns available in node, and explains how domains can be used to improve it.

There are four main error handling patterns in node:

  • Error return value
@phplaw
phplaw / use $compile outside a directive in Angularjs
Last active July 10, 2018 11:46 — forked from shengoo/use $compile outside a directive in Angularjs
use $compile outside a directive in Angularjs
$(function() {
// myApp for test directive to work, ng for $compile
var $injector = angular.injector(['ng', 'myApp']);
$injector.invoke(function($rootScope, $compile) {
$('body').prepend($compile('<div ng-attr-tooltip="test">Cancel</div>')($rootScope));
});
});
/**
@phplaw
phplaw / ng-repeat-complete.htm
Created April 12, 2018 11:26 — forked from bennadel/ng-repeat-complete.htm
Hooking Into The Complete Event Of An ngRepeat Loop In AngularJS
<!doctype html>
<html ng-app="Demo">
<head>
<meta charset="utf-8" />
<title>
Hooking Into The ngRepeat Completion Event In AngularJS
</title>
<style type="text/css">
@phplaw
phplaw / angularjs_directive_attribute_explanation.md
Created March 6, 2017 03:21 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
<?php
function time2str($ts) {
if(!ctype_digit($ts)) {
$ts = strtotime($ts);
}
$diff = time() - $ts;
if($diff == 0) {
return 'now';
} elseif($diff > 0) {
$day_diff = floor($diff / 86400);
- Defining a field
- hook_field_info()
- hook_field_schema()
- hook_field_validate()
- hook_field_is_empty()
- Defining a formatter for the field (the portion that outputs the field for display)
- hook_field_formatter_info()
- hook_field_formatter_view()
- Defining a widget for the edit form
- hook_field_widget_info()