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
/* | |
* Top level Request error handler | |
* - Similar to $.ajaxError in JQuery | |
*/ | |
Class.refactor(Request, { | |
__refactor_default_onComplete : null, | |
initialize : function(options) { | |
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
/* | |
# Usage in html template: | |
"xxx | nl2br" | |
<div ng-bind-html=" YourString | nl2br "></div> | |
or: |
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
function updateIsolateScope (element, data) { | |
var directiveScope = element.isolateScope(); | |
directiveScope = angular.extend(directiveScope, data); | |
element.data('$isolateScope', directiveScope); | |
} |
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
# to run in a Rails console ! | |
def returning(value) | |
yield(value) | |
value | |
end | |
class Hash | |
def deep_reject_key!(key) | |
keys.each {|k| delete(k) if k == key || self[k] == self[key] } |
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
class Hash | |
# {'x'=>{'y'=>{'z'=>1,'a'=>2}}}.leaves == [1,2] | |
def leaves | |
leaves = [] | |
each_value do |value| | |
if value.is_a?(Hash) | |
value.leaves.each{|l| leaves << l } | |
elsif value.is_a?(Array) | |
value.each{|l| leaves << l } |
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
interface Person { | |
id: string; | |
name: string; | |
} | |
function sayHello(person: Person) { | |
console.log(person.name); | |
} | |
sayHello({} as any); |
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 { NetworkStatus, isNetworkRequestInFlight } from 'apollo-client/core/networkStatus'; | |
type isNetworkTransitionArg = { | |
networkStatus: NetworkStatus; | |
}; | |
export enum NetworkTransition { | |
LOADED_DATA, | |
WAS_IN_CACHE, | |
LOADING, |
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
exports.handler = (event, context, callback) => { | |
var AWS = require('aws-sdk'); | |
AWS.config.update({region: 'eu-west-1'}); // configure region | |
const athena = new AWS.Athena(); | |
athena.getNamedQuery({ NamedQueryId: '<your-query-id>' }, function(err, data) { | |
console.log('getNamedQuery', err, data); | |
if (!err) { | |
var params = { | |
QueryString: data.NamedQuery.QueryString, |
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 { ApolloLink, NextLink, Operation } from 'apollo-link'; | |
import { JasonBourne } from '../../../service/Marketing/JasonBourne'; | |
const PERF_MONITORED_OPERATIONS = [ | |
'loadChatsList', | |
// ... | |
]; | |
export const perfMonitorLink = new ApolloLink((operation: Operation, forward?: NextLink) => { | |
const startTime = new Date().getTime(); |
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
{ | |
"anonymousId": "<removed>", | |
"context": { | |
"library": { | |
"name": "analytics.js", | |
"version": "3.2.5" | |
}, | |
"page": { | |
"path": "<removed>", | |
"referrer": "<removed>", |
OlderNewer