Skip to content

Instantly share code, notes, and snippets.

@kamikaz1k
kamikaz1k / Jenkinsfile
Created July 16, 2019 18:36
declarative Jenkins pipeline sample
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import java.util.Date
datadog = new com.freshbooks.jenkinshelper.datadog()
github = new com.freshbooks.jenkinshelper.GitHub()
helper = new com.freshbooks.jenkinshelper.pipelinehelper()
slack = new com.freshbooks.jenkinshelper.slack()
def APP_NAME = 'service-name'
@kamikaz1k
kamikaz1k / OSX-Convert-MOV-GIF.md
Created May 13, 2017 17:17 — forked from tskaggs/OSX-Convert-MOV-GIF.md
Creating GIFs from .MOV files in OSX using FFmpeg and ImageMagick

Convert MOV to GIF using FFmpeg and ImageMagick

I tried a few different techniques to make a GIF via command-line and the following gives me the best control of quality and size. Once you're all setup, you'll be pumping out GIFs in no time!

Preparation

Install FFmpeg

  • $ brew install ffmpeg [all your options]
    • Example: $ brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools

Install ImageMagick

@kamikaz1k
kamikaz1k / phone-number-directiveUpdate.js
Created July 23, 2016 15:50
Phone Number component directive update
{
...
function validateInput (fieldId) {
if (/US|CA/.test(scope.countryCode)) { ... }
else { ... }
// Update internal update flag so that splitModel function
// knows that it was an internal trigger
directiveUpdate = true;
@kamikaz1k
kamikaz1k / phone-number.html
Created July 23, 2016 15:41
Phone Number Component Template
<div ng-form="phoneNumberForm">
<span ng-if="countryCode === 'CA' || countryCode === 'US'">
<span>+</span>
<input type="text"
ng-model="phone.countryCode"
ng-disabled="true">
<span>(</span>
<input type="text"
ng-model="phone.areaCode"
ng-pattern="/^[0-9]{3}$/"
@kamikaz1k
kamikaz1k / phone-number-validateInput.js
Created July 23, 2016 15:40
Phone Number component validate input
{
...
scope.validateInput = function validateInput(fieldId) {
var phone = scope.phone;
// Validate input for US/CA Form
if (/US|CA/.test(scope.countryCode)) {
// If all the model values have values,
@kamikaz1k
kamikaz1k / phone-number-splitModel.js
Last active July 23, 2016 15:51
Phone Number component splitmodel function
link: function postLink (scope, element, attributes, ngModelCtrl) {
...
// Step 2.
// Set watcher on parentModel so that internal model is updated
scope.$watch("parentModel", function () {
splitModel();
});
// Function takes the parentModel value and splits it up
// to populate the internal data model
@kamikaz1k
kamikaz1k / phone-number-ng-if.html
Created July 23, 2016 15:38
Phone Number component html ngif
<div ng-form="phoneNumberForm">
<!-- Step 1. -->
<span ng-if="countryCode === 'CA' || countryCode === 'US'">
...
</span>
<span ng-if="countryCode !== 'CA' && countryCode !== 'US'">
...
</span>
</div>
@kamikaz1k
kamikaz1k / phone-number-formValidation.js
Created July 23, 2016 15:38
Phone Number form validation
function validateInput(fieldId) {
if (/US|CA/.test(scope.countryCode)) {
...
// pass
ngModelCtrl.$setValidity("validPhone", true);
scope.parentModel = phone.international;
...
// fail
ngModelCtrl.$setValidity("validPhone", false);
scope.parentModel = "";
@kamikaz1k
kamikaz1k / phone-number-autofocus.js
Last active July 23, 2016 15:54
Phone Number Directive autofocus
link: function postLink (scope, element, attributes, ngModelCtrl) {
...
function splitModel (fieldId) {
...
// If areaCode exists, and current focus is on
if (phone.areaCode && fieldId === "area") {
element.find("#phoneOne").focus();
}
else if (phone.phoneOne && fieldId === "one") {
@kamikaz1k
kamikaz1k / form.html
Created July 23, 2016 15:15
Phone Number Element usage
<form name="customerProfile"
<phone-number name="phone" ng-model="phone" country-code="cc" ng-required="true" />
</form>