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
if (!('indexOf' in Array.prototype)) { | |
Array.prototype.indexOf = function(find) { | |
var i = 0; | |
for (var n = this.length; i<n; i++) { | |
if (i in this && this[i] == find) { | |
return i; | |
} | |
} | |
return -1; |
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
// | |
var SIT = { | |
P_GLOBAL_FLOAT_NUM : 2, | |
P_GLOBAL_FLOAT_DEC : 10, | |
P_GLOBAL_FLOAT_STEP : 1 | |
} | |
// | |
obips.SliderBase.Controller.prototype.incrementAValue = function (a) { | |
return this.adjust( |
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
/** | |
* | |
* Hierarchy Builder | |
* hierarchy can be builded via xml-file and json | |
* | |
* Methods: | |
* 1. [not required parameter] opened list level: SIT.listLevelOpen | |
* (e.g. SIT.listLevelOpen = 2) it means that "systemRoot", 1 level and 2 level will be opened after load | |
* | |
* 2. public function for hierarchy builder via XML: SIT.buildHierarchyWithXML(node, XMLUrl, treeModelId, winTarget) { |
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
<!--> example of div | |
<div id="_autoref1"></div> | |
<--> | |
<script type="text/javascript"> | |
/** | |
1. Add to analysis "<div id="_autoref1"></div>" with some specified id (f.i. _autoref1) using Static Text or Narrative or something else | |
2. If you have a lot of analyses, you need to add a div to each of them using unique id (for example, _autoref1, _autoref2, _autoref3 and etc.) | |
3. Change var "refreshIds" by adding all the ids you have used in analyses to refresh | |
4. Next step is to add analyses to dashboard and add script below on the dashboard page | |
*/ |
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 int switchPin = 2; // digital pin for glass reed | |
const int lightPin = 3; // digital pin for light | |
const String sensorId = "111A0"; // id of the sensor | |
int lightValue = 0; // global light value | |
boolean isAutoChanged = false; // global variable to track changes | |
void setup() { | |
pinMode(switchPin, INPUT); | |
pinMode(lightPin, OUTPUT); | |
digitalWrite(switchPin, HIGH); |
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
package project1; | |
public class TransformationCount { | |
public TransformationCount() { | |
super(); | |
} | |
// check if word is an anagram | |
private static boolean isAnagram(String a) { | |
if (a.isEmpty() || a.length() == 1) |
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
// | |
// SVG — hasClass, addClass, removeClass, toggleClass | |
// Source: | |
// https://gist.github.com/branneman/8436956 | |
// Taken and adapted from: | |
// http://toddmotto.com/hacking-svg-traversing-with-ease-addclass-removeclass-toggleclass-functions/ | |
// | |
if (SVGElement && SVGElement.prototype) { |
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 to fetch Yahoo Finance data and write it back to the spreadsheet | |
### How to run ### | |
# | |
# Save script somewhere on a hard drive (let's say test.py) | |
# Open a command line (or terminal on Mac OS) | |
# Assuming that python interactive interpreter is not loaded run: | |
# > python test.py -u username -p password | |
# where "username" and "password" is credentials to access Google Sheets spreadsheet | |
# | |
### Work Flow ### |
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
{"admin": {"password": "d63dc919e201d7bc4c825630d2cf25fdc93d4b2f0d46706d29038d01", "level": "admin"}, "sadikovi": {"password": "90a3ed9e32b2aaf4c61c410eb925426119e1a9dc53d4286ade99a809", "level": "user"}} |
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
'#Public - Builds hierarchy in place' | |
def buildHierarchy(self): | |
#create dictionary {"parent_id":["child1", "child2",..]} | |
pmap = {} #map where all the children are mapped to their parent ids | |
roots = [] #roots - elements with parent "None" | |
for key in self.keys(): | |
group = self.get(key) | |
pid = group.getParent() if self.has(group.getParent()) else None | |
#if pid is None, we know that it is a root element | |
if pid is None: roots.append(group) |