Skip to content

Instantly share code, notes, and snippets.

View liesislukas's full-sized avatar
🚀
Excited

Lukas Liesis liesislukas

🚀
Excited
View GitHub Profile
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) {
@liesislukas
liesislukas / gulpfile.js
Created November 20, 2015 10:15 — forked from emilniklas/gulpfile.js
Gulpfile with LiveReload, Sass, and Browserify with Babelify (JSX harmony)
// ============================================================
// $ 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';
"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,
},
@liesislukas
liesislukas / getAvailableCountries()
Created December 31, 2015 13:35
all countries list in js array
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"},
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());
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){
let isPrime = (num) =>{
let divisor = 2;
while(divisor < num){
if(num % divisor === 0 ){
return false;
}
divisor++;
}
return true;
}
let getF = (n) => {
if (n < 2) return n;
var a = 0,
b = 1,
result;
for (var i = 2; i <=n; i++ ){
result = a + b;
//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;
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);