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
static getSizeInContainer(item_x, item_y, container_x, container_y) { | |
/* euclidean GCD (feel free to use any other) */ | |
function gcd(a, b) { | |
if (b > a) { | |
temp = a; | |
a = b; | |
b = temp | |
} | |
while (b != 0) { |
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
// ============================================================ | |
// $ npm install --save-dev gulp-util node-notifier gulp vinyl-source-stream vinyl-buffer gulp-uglify gulp-sourcemaps gulp-livereload browserify watchify babelify gulp-ruby-sass gulp-autoprefixer gulp-rename | |
// ============================================================ | |
function Workflow() | |
{ | |
// Override workflow settings here | |
// Example: | |
// this.output.directory = 'public_html'; |
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
"use strict"; | |
const React = require('react'); | |
const assign = require('object-assign'); | |
const FormInput = React.createClass({ | |
propTypes: { | |
size: React.PropTypes.oneOf(['small', 'normal']), | |
highlight_color: React.PropTypes.string, | |
placeholder: React.PropTypes.string, | |
}, |
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
getAvailableCountries(){ | |
return [ | |
{country_code: "US", country_name: "United States"}, | |
{country_code: "CA", country_name: "Canada"}, | |
{country_code: "GB", country_name: "United Kingdom"}, | |
{country_code: "AU", country_name: "Australia"}, | |
{country_code: "DE", country_name: "Germany"}, | |
{country_code: "AX", country_name: "Åland Islands"}, | |
{country_code: "AF", country_name: "Afghanistan"}, | |
{country_code: "AL", country_name: "Albania"}, |
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
var ls = { | |
set: function (variable, value, ttl_ms) { | |
var data = {value: value, expires_at: new Date().getTime() + ttl_ms / 1}; | |
localStorage.setItem(variable.toString(), JSON.stringify(data)); | |
}, | |
get: function (variable) { | |
var data = JSON.parse(localStorage.getItem(variable.toString())); | |
if (data !== null) { | |
if (data.expires_at !== null && data.expires_at < new Date().getTime()) { | |
localStorage.removeItem(variable.toString()); |
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
let list = [2,5,78,3,32,1.5,5,7,542,43,5,7,4,12,1,2,5,78,34,78,486,76845,834,15,7,5,6,8,4,6,4,8,62,768,7,3,65,4,78,51,26,68,45,2,1,5,9,3,212,56,5412,2565,47,8,652,56585,4,15,84,1,22,3,66,54,112,65654,421,2655,4,86,21564564,54444,51,1,5,12,5,8,67,86,46,87,64,8,78,786,3513,786,384,76,345,3,48,4,53,151,384,45,32,5,7,542,43,5,7,4,12,1]; | |
let binaryFind = (haystack, needle) => { | |
let hi = haystack.length -1; | |
let lo = 0; | |
let mid; | |
let cycles = 0; | |
while(lo <= hi){ |
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
let isPrime = (num) =>{ | |
let divisor = 2; | |
while(divisor < num){ | |
if(num % divisor === 0 ){ | |
return false; | |
} | |
divisor++; | |
} | |
return true; | |
} |
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
let getF = (n) => { | |
if (n < 2) return n; | |
var a = 0, | |
b = 1, | |
result; | |
for (var i = 2; i <=n; i++ ){ | |
result = a + b; |
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
//source: http://stackoverflow.com/questions/17722497/scroll-smoothly-to-specific-element-on-page | |
function currentYPosition() { | |
// Firefox, Chrome, Opera, Safari | |
if (self.pageYOffset) return self.pageYOffset; | |
// Internet Explorer 6 - standards mode | |
if (document.documentElement && document.documentElement.scrollTop) | |
return document.documentElement.scrollTop; | |
// Internet Explorer 6, 7 and 8 | |
if (document.body.scrollTop) return document.body.scrollTop; |
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 React from 'react'; | |
import DropDownMenu from 'material-ui/DropDownMenu'; | |
import MenuItem from 'material-ui/MenuItem'; | |
class DropdownEditOnClick extends React.Component { | |
constructor() { | |
super(); | |
this.state = {show_input: false}; | |
this.renderText = this.renderText.bind(this); |
OlderNewer