This file contains hidden or 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 Solver(startCoconuts, sailors) { | |
| this.coconuts = startCoconuts; | |
| this.sailors = sailors; | |
| this.calls = 0; | |
| } | |
| Solver.prototype.canBeDividedBySailorsMinusOne = function() { | |
| if ((this.coconuts / (this.sailors - 1)) % 1 === 0) { | |
| return true; | |
| } |
This file contains hidden or 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 getThem(args) { | |
| var obj = []; | |
| //'(a, b, c, d, e, f)' | |
| console.log(args.callee.toString()); | |
| var tmp = args.callee.toString().match(/\(.*?\)/g)[0]; | |
| //["a", "b", "c", "d", "e", "f"] | |
| var argumentNames = tmp.replace(/[()\s]/g,'').split(','); | |
| var list = {}; | |
| [].splice.call(args,0).forEach(function(arg,i) { |
This file contains hidden or 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
| <script> | |
| import dynamics from 'dynamics.js' | |
| import _ from 'lodash' | |
| export default { | |
| data () { | |
| return { | |
| dotCount: 3 | |
| } | |
| }, |
This file contains hidden or 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
| #!/bin/bash | |
| exec &>> backup_log.txt | |
| DATE=`date +%Y-%m-%d` | |
| SOURCE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/." | |
| TARGET="___SOME_PATH___/${DATE}" | |
| echo "${DATE}: Starting Backup" | |
| mkdir -p ${TARGET} | |
| cp -ar ${SOURCE} ${TARGET} |
This file contains hidden or 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 store = require('store'); | |
| const MINUTES_UNITL_AUTO_LOGOUT = 5 // in mins | |
| const CHECK_INTERVAL = 1000 // in ms | |
| const STORE_KEY = 'lastAction'; | |
| class AutoLogoutService { | |
| get lastAction() { | |
| return parseInt(store.get(STORE_KEY)); |
This file contains hidden or 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 { alterItems } = require('feathers-hooks-common'); | |
| function getPromise() { | |
| return new Promise(res => setTimeout(() => res('something'), 500)) | |
| } | |
| const context = { | |
| type: 'after', | |
| method: 'get', | |
| result: { |
This file contains hidden or 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
| app.service(‘products’).watch().find() |
This file contains hidden or 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 feathers from '@feathersjs/feathers' | |
| import * as io from 'socket.io-client' | |
| import socketio from '@feathersjs/socketio-client' | |
| import * as rx from 'feathers-reactive' | |
| const app = feathers() | |
| const socket = io(BASE_URL) | |
| app | |
| .configure(socketio(socket)) | |
| .configure(rx({ idField: '_id' })) |
This file contains hidden or 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
| @Injectable() | |
| export class DataService { | |
| constructor( | |
| ) { | |
| const socket = io(this.BASE_URL) | |
| this.app | |
| .configure(socketio(socket)) | |
| .configure(rx({ idField: '_id' })) | |
| } |
This file contains hidden or 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 { Observable } from 'rxjs/Observable' | |
| export function rxUniversal(options = {}) { | |
| const mixin = function (service) { | |
| const app = this | |
| const serviceMixin = { | |
| watch(watchOptions = {}) { | |
| const methods = {} |
OlderNewer