Skip to content

Instantly share code, notes, and snippets.

@Takeno
Takeno / index.html
Created November 28, 2020 12:25
Single-file-react
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<!-- We will put our React component inside this div. -->
<div id="root"></div>
import React, {Component} from 'react';
import {StyleSheet} from 'react-native';
import Drawer from 'react-native-drawer';
import {DefaultRenderer} from 'react-native-router-flux';
import SideMenu from '../Layouts/Sidebar'; // My menu component
export default class extends Component {
render() {
const children = this.props.navigationState.children;
@Takeno
Takeno / package.json
Created July 15, 2016 16:05
Webpack basic configuration - dev/prod + react + es6 + less
{
"scripts": {
"start": "node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --watch",
"build": "node_modules/webpack/bin/webpack.js --config prod.webpack.config.js -p"
},
"devDependencies": {
"babel-core": "^6.10.4",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
@Takeno
Takeno / README.md
Created November 17, 2015 17:19
Locate JS

Write a function named "locate" that gets an array and value and returns true if specified value exist in a multidimentional array.

Example:

locate(['a','b',['c','d',['e']]],'e'); // should return true
locate(['a','b',['c','d',['e']]],'a'); // should return true
locate(['a','b',['c','d',['e']]],'f'); // should return false
@Takeno
Takeno / Product.java
Last active August 29, 2015 13:57
SIW-Products
package it.uniroma3.db.products;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Column;
@Entity
@Takeno
Takeno / example.html
Created November 26, 2013 14:33
Scrollbar appears on mouseover and only if you need it
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="mouseover.scrollbars.jquery.js"></script>
<style>
/* Plugin properties */
.scrollable {
@Takeno
Takeno / convert.py
Created September 30, 2013 11:38
Lineage 2 Music ogg decrypter
import mmap
import sys
import os
import glob
if len(sys.argv) != 2:
sys.exit('Usage: %s directory' % sys.argv[0])
if not os.path.exists(sys.argv[1]):
sys.exit('ERROR: directory %s was not found!' % sys.argv[1])
@Takeno
Takeno / snippet.js
Last active December 20, 2015 08:09
Hide navigation bar on iphone. It will appear only with a double tap on header
$(document).on('touchmove',function(e){
e.preventDefault();
});
$('body').on('touchstart','.scrollable',function(e) {
if (e.currentTarget.scrollTop === 0)
e.currentTarget.scrollTop = 1;
else if (e.currentTarget.scrollHeight === e.currentTarget.scrollTop + e.currentTarget.offsetHeight)
e.currentTarget.scrollTop -= 1;
});
<?php
/*
* Usage: php tinypng.php /absolute/path/
* OR
* Usage: php tinypng.php relative/path/
*
* Requirement: "tmp" dir in the same path of tinypng.php
*/