Skip to content

Instantly share code, notes, and snippets.

@piecyk
piecyk / robot.js
Created December 4, 2012 12:05 — forked from fabiopimentel/robot.js
[CAELUM TEAM]Megatron
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();
function updateCondition() {
try {
if ($scope.data && $scope.data.values[0]) {
$scope.members.rightOperand.value = $scope.data.values[0];
}
if (_.contains(['reference', 'static'], $scope.members.rightOperand['@type'])) {
if ($scope.data.values[0].open && ($scope.members.rightOperand.open = $scope.data.values[0].open)) {
$scope.members.rightOperand.value = null;
}
}
it('user should filter results by advance con e-mail', function() {
var s = new tools.commonPageObj();
s.get();
s.setSearchInput('Julie');
s.doGlobalSearch();
s.openBasicPanel();
s.isModalDisplayed('.modal-rw-basic', true);
s.isAdvanceConBtnActive(false);
s.selectTemlateBasicPanel('Person');
function updateValuesAfterCreationRefferedDC(targetAttributeId,updateCallBack){
if(queue.length > 0){
var queueLast = queue[queue.length-1];
if(queueLast.randomKey === $stateParams.randomKey){
if(queueLast.scope.data.gaId == targetAttributeId && queueLast != null){
if(queueLast.refferedDCId != null){
updateCallBack(queueLast.refferedDCId);
}
queue.pop();
}
;; Turn off mouse interface early in startup to avoid momentary display
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
;; No splash screen please ... jeez
(setq inhibit-startup-message t)
(mouse-wheel-mode t)
{
"folder": null,
"module": null,
"templates": [{
"id": "64",
"name": "Alert",
"code": "bhd",
"allowingFolderIds": ["110"]
}],
"searchKey": null,
function findParentsInTree(bookmark, tree, whatToDoWithNode) {
var PARENT;
var _factorial = function myself(parent, array) {
if (!bookmark) return;
for(var i = 0; i < array.length; i++) {
myself(array[i], array[i].nodes);
if (bookmark && (array[i].id === bookmark.id && array[i].nodeType === bookmark.nodeType)) {
var _DC_ID = null;
function _getRetMsg() {
var ret = '';
switch ($state.current.name) {
case 'workspace.datacard.edit':
case 'bg-data.module.datacard.edit':
_DC_ID = $stateParams.id;
ret = 'dc edit ws';
break;
case 'workspace.datacard.transform':
@piecyk
piecyk / gist:11089712
Created April 19, 2014 16:36
Exmaple using undersorejs Chaining Methods with Arrow functions |
var stooges = [{name: 'curly', age: 25}, {name: 'moe', age: 21}, {name: 'larry', age: 23}];
var youngest = _.chain(stooges)
.sortBy(function(stooge){ return stooge.age; })
.map(function(stooge){ return stooge.name + ' is ' + stooge.age; })
.first()
.value();
== "moe is 21"
== and with Arrow functions
function solution(A) {
// you can use console.log for debugging purposes, i.e.
// console.log('this is debug message');
// write your code in JavaScript (ECMA-262, 5th edition)
if (A.length === 1) return 0;
var len = A.length,
result = 0;
// how many pairs of coins we have now