Skip to content

Instantly share code, notes, and snippets.

function fetchData(callback) {
// Simulating an API call with setTimeout:
setTimeout(() => {
console.log("Data fetched");
callback("Sample data");
}, 1000);
}
function processData() {
console.log("Processing data...");
function fetchData(callback) {
// Simulating an API call with setTimeout:
setTimeout(() => {
console.log("Data fetched");
callback("Sample data");
}, 1000);
}
function processData() {
console.log("Processing data...");
function fetchData(callback) {
// Simulating an API call with setTimeout:
setTimeout(() => {
console.log("Data fetched");
callback("Sample data");
}, 1000);
}
function processData() {
console.log("Processing data...");
function fetchData(callback) {
// Simulating an API call with setTimeout:
setTimeout(() => {
console.log("Data fetched");
callback("Sample data");
}, 1000);
}
function processData() {
console.log("Processing data...");
@hakilebara
hakilebara / controllers.application\.js
Last active November 7, 2021 23:36
validation modifer - running validations
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { isBlank } from '@ember/utils';
export default class ApplicationController extends Controller {
@action
handleValidated({ target: { validationMessage, name } }) {
console.log('did-validate event caught by form');
console.table([{
@hakilebara
hakilebara / controllers.application\.js
Last active November 3, 2021 11:38
validation modifier - display validations
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { isEmpty } from '@ember/utils';
import { tracked } from '@glimmer/tracking';
class Validation {
@tracked message = '';
@tracked displayError = false;
get displayMessage() {
// This is the main script function
function myFunction() {
var ss = SpreadsheetApp.getActiveSpreadsheet()
// target repositories
var openedPullRequestsSpreadsheet = ss.getSheetByName('OPEN_PULL_REQUESTS');
// spreadsheet that contains a list of Github repositories
var coreRepositoriesSpreadsheet = ss.getSheetByName('CORE_REPOSITORIES');
@hakilebara
hakilebara / controllers.application.js
Last active March 14, 2019 10:14
Ember Modal Dialog & Focus Trap
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@hakilebara
hakilebara / controllers.application.js
Created December 20, 2018 10:19
ember-focus-trapper bug
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Component from '@ember/component';
import { computed } from '@ember/object';
export default Component.extend({
index: 0,
selectedAttachment: computed('attachments.[]', 'index', function() {
return this.attachments[Number(this.index)];
}),