This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A bookmarklet for viewing the largest contentful paint in a page. | |
* Will show each LCP after the bookmarklet is clicked. | |
* | |
* To install: | |
* 1. Copy the code starting from the line beginning `javascript:` | |
* 2. Add a new bookmark in Chrome, and paste the code in as the URL. | |
**/ | |
javascript:(function(){ | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
email_delivery: | |
delivery_method: :smtp | |
smtp_settings: | |
enable_starttls_auto: true | |
address: "AWS_SMTP_DOMAIN" | |
port: 587 | |
domain: "REDMINE_DOMAIN" | |
authentication: :login | |
user_name: "YOUR_SMTP_USER" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: 三竹簡訊 Webhook | |
Plugin URI: https://gist.github.com/nczz/750c3d8d18b9e0ca07ca06a248c11570 | |
Description: 接收 Webhook 請求發送簡訊 | |
Author: Chun | |
Version: 1.0 | |
Author URI: https://www.mxp.tw/ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('A').directive('formAutofillFix', function ($timeout) { | |
return function (scope, element, attrs) { | |
element.prop('method', 'post'); | |
if (attrs.ngSubmit) { | |
$timeout(function () { | |
element | |
.unbind('submit') | |
.bind('submit', function (event) { | |
event.preventDefault(); | |
element |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('chromedriver'); | |
const path = require('path'); | |
const wd = require('selenium-webdriver'); | |
const chrome = require('selenium-webdriver/chrome'); | |
var builder = new wd.Builder(); | |
var options = new chrome.Options(); | |
var prefs = new wd.logging.Preferences(); | |
var driver; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Handling Errors using async/await | |
* Has to be used inside an async function | |
*/ | |
try { | |
const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
// Success 🎉 | |
console.log(response); | |
} catch (error) { | |
// Error 😨 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const THREE = require('three'); | |
function AjaxTextureLoader() { | |
/** | |
* Three's texture loader doesn't support onProgress events, because it uses image tags under the hood. | |
* | |
* A simple workaround is to AJAX the file into the cache with a FileLoader, then extract that into a | |
* texture with a separate TextureLoader call. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works | |
const axios = require('axios'); // promised based requests - like fetch() | |
function getCoffee() { | |
return new Promise(resolve => { | |
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import axios, { post } from 'axios'; | |
class SimpleReactFileUpload extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state ={ | |
file:null | |
} |
NewerOlder