Skip to content

Instantly share code, notes, and snippets.

@adactio
adactio / saveTextarea.js
Last active December 2, 2023 06:52
Put the contents of a textarea into localStorage if the user leaves the page before submitting the form.
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
(function (win, doc) {
// Cut the mustard.
if (!win.localStorage) return;
// You should probably use a more specific selector than this.
var textarea = doc.querySelector('textarea');
// The key for the key/value pair in localStorage is the current URL.
var key = win.location.href;
@calebporzio
calebporzio / LivewireLoginTest.php
Created January 27, 2020 01:33
A Livewire Test
<?php
namespace Tests\Feature;
use App\User;
use Tests\TestCase;
use Livewire\Livewire;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Testing\RefreshDatabase;
<?php
$q = [2,1,5,3,4];
minimumBribes($q);
function minimumBribes($q) {
$no_ans = 'Too chaotic';
$ans = 0;
@colbyfayock
colbyfayock / Feature.md
Created April 25, 2019 12:47
E84 merge request template

Overview

What is the feature?

(Describe what the feature is)

What is the solution?

(Describe at a high level how the feature was implemented)

What areas of the site does impact?

(Describe what parts of the site are impacted andifcode touched other areas)

@berkedel
berkedel / flow-error-icu4c-not-loaded.md
Created April 4, 2018 14:13
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

How to solve dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

brew uninstall --ignore-dependencies node icu4c
brew install node
@ttscoff
ttscoff / changelog.rb
Last active September 5, 2024 18:16
Generate release notes from git commit messages
#!/usr/bin/ruby -W1
# frozen_string_literal: true
require 'optparse'
require 'shellwords'
# A script to automate changelog generation from Git commit messages
#
# For use with a git-flow workflow, it will take changes from the last tagged
# release where commit messages contain NEW, FIXED, CHANGED, and IMPROVED
@mixin for-phone-only {
@media (max-width: 599px) { @content; }
}
@mixin for-tablet-portrait-up {
@media (min-width: 600px) { @content; }
}
@mixin for-tablet-landscape-up {
@media (min-width: 900px) { @content; }
}
@mixin for-desktop-up {
@katronai
katronai / consume-soap.js
Last active June 7, 2018 12:43
Node.js, AWS Lambda - Consume a SOAP service that requires WS-Addressing and v1.2 specification using node-soap module
var soap = require('soap');
var url = 'http://example.org/MyWebService.svc?wsdl';
var soapOptions = {
forceSoap12Headers: true
};
var soapHeader = {
'wsa:Action': 'http://tempuri.org/MyBinding/MyOperation',
@mcnamee
mcnamee / bitbucket-pipelines.yml
Last active December 14, 2023 03:57
Bitbucket Pipelines - Deploy via FTP to shared hosting
# Installation ---
# 1. In Bitbucket, add FTP_USERNAME, FTP_PASSWORD and FTP_HOST as environment variables.
# 2. Commit this file (bitbucket-pipelines.yml) to your repo (in the repo root dir)
# 3. From Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:Init (this will
# push everything and initialize GitFTP)
#
# Usage ---
# - On each commit to master branch, it'll push all files to the $FTP_HOST
# - You also have the option to 'init' (see 'Installation' above) - pushes everything and initialises
# - Finally you can also 'deploy-all' (from Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:deploy-all)
@paulferrett
paulferrett / timezones_and_geo_coordinates.csv
Created May 16, 2016 10:32
List of Timezones and their Geo Coordinates
Africa/Abidjan 5.359952 -4.008256 +0:00
Africa/Accra 5.603717 -0.186964 +0:00
Africa/Addis_Ababa 8.980603 38.757761 +03:00
Africa/Algiers 36.75377 3.058793 +01:00
Africa/Asmera 15.322877 38.925052 +03:00
Africa/Bamako 12.639232 -8.002889 +0:00
Africa/Bangui 4.394674 18.55819 +01:00
Africa/Banjul 13.454876 -16.579032 +0:00
Africa/Bissau 11.881655 -15.617794 +0:00
Africa/Blantyre -15.766671 35.016787 +02:00