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
public getAvailability(apiToken) { | |
return new Promise((resolve, reject) => { | |
axios.get('api/connect/hotels/id/availability') | |
.then((response) => resolve(response.data)) | |
.catch(error => reject(new HttpRequestError(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 result = await polly().handle(console.error) | |
.waitAndRetry(retryTimes).executeForPromise(async () => { | |
return axios.get(`${apiUrl}/booking/v1/offer-index`, requestConfig); | |
}) |
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
// These are all the queries being run | |
// also this is a bit slow | |
[10s] SELECT "entries".* FROM "entries" WHERE "entries"."referrer" = $1 ORDER BY "entries"."created_at" DESC [["referrer", "http://localhost"]] | |
[10s] SELECT COUNT(*) FROM "entries" WHERE "entries"."referrer" = $1 AND "entries"."widget_id" = $2 AND (content -> 'action' ? 'open' and content -> 'type' ? 'slide_callout') AND (created_at >= '1970-04-17 14:57:56.675928' AND created_at <= '2020-04-17 14:57:59.557860') [["referrer", "http://localhost"], ["widget_id", 1]] | |
[10s] SELECT COUNT(*) FROM "entries" WHERE "entries"."referrer" = $1 [["referrer", "http://localhost"]] | |
// this one seems to be the culprit | |
[10s] SELECT "entries".* FROM "entries" WHERE "entries"."referrer" = $1 AND (extract(year from created_at) = '2020') AND (extract(month from created_at) = '04') ORDER BY "entries"."created_at" DESC [["referrer", "http://localhost"]] |
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
monolog: | |
handlers: | |
app: | |
type: stream | |
path: "%kernel.logs_dir%/%kernel.environment%_app.log" | |
level: debug | |
channels: ["!event", "!request", "!security"] | |
formatter: app.line_formatter | |
excluded_404s: | |
- .* |
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 Ember from 'ember'; | |
export default Ember.Route.extend({ | |
'currentOrder': Ember.inject.service(), | |
model(){ | |
return Ember.Object.create({ | |
// in the template: (subclass of Ember.ArrayProxy) == :) | |
'invoices': this.get('store').findAll('invoice'), | |
// in the template: [object Object] == :( | |
'currentOrders': this.get('currentOrder').current() |
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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
}); |
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
t |
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
ini_set("default_socket_timeout", "1"); | |
class SocketWorker implements | |
{ | |
private $socketResource; | |
private $socketErrorNum; | |
private $socketErrorStr; | |
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 | |
try { | |
explode('not an array'); | |
}catch(\Exception $e){ | |
echo "Couldn't explode"; | |
} | |
/* Outputs: | |
PHP Warning: explode() expects at least 2 parameters, 1 given in /private/tmp/test.php on line 4 |
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 mechanize | |
from lxml import etree | |
from StringIO import StringIO | |
def get_text_recursive(node): | |
return (node.text or '') + ''.join(map(get_text_recursive, node)) + (node.tail or '') | |
def browser_to_xml(browser): | |
htmlparser = etree.HTMLParser() | |
try: |
NewerOlder