Skip to content

Instantly share code, notes, and snippets.

View fongreecss's full-sized avatar
:octocat:
working

Fon Greecss fongreecss

:octocat:
working
  • Slovenia
View GitHub Profile
@fongreecss
fongreecss / inViewport.js
Created November 29, 2018 15:47
add visible classes to elements with .active-area class
function inViewport() {
$('.active-area').each(function(){
let divPos = $(this).offset().top,
topOfWindow = $(window).scrollTop();
if( divPos < topOfWindow+$(window).height() ){
$(this).addClass('visible');
}
});
}
function isIOS() {
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
// iOS detection from: http://stackoverflow.com/a/9039885/177710
return (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream);
}
@fongreecss
fongreecss / installcomposer
Created June 18, 2018 10:42
Install composer
function installcomposer() {
sudo wget https://getcomposer.org/download/1.6.5/composer.phar -O /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer
}
@fongreecss
fongreecss / addsite
Last active November 11, 2018 12:19
Function that creates website localhost environment (apache2 testing purposes)
function addsite(){
#not recommended to use on production server!!!
#req:
# - apache,
# - php (at least 7 for new magento),
# - wp-cli (wordpress comand line),
# - composer
# - laravel
@fongreecss
fongreecss / gulpfile.js
Last active April 29, 2020 12:08
Typescript, watchify, gulp - minimal conf with error logging on the console
var gulp = require('gulp');
var ts = require('gulp-typescript');
var browserify = require("browserify");
var source = require('vinyl-source-stream');
var watchify = require("watchify");
var tsify = require("tsify");
var gutil = require("gulp-util");
gulp.task('typescript', function () {
return gulp.src('./app/src/**/*.ts')
#!/bin/bash
#
# sudo apt-get install jpegoptim
# sudo apt-get install optipng
#
IMGFOLDER=/path/to/image/folder
JPGLOG=/path/to/image/folder/jpegoptim.log
PNGLOG=/path/to/image/folder/pngoptim.log
JPGCOMPRESSION=75
echo `date` >> $PNGLOG
@fongreecss
fongreecss / fetlc
Last active August 1, 2017 08:32
File extension to lower case
function fetlc() {
find . -name '*.*' -exec sh -c '
a=$(echo "$0" | sed -r "s/([^.]*)\$/\L\1/");
[ "$a" != "$0" ] && mv "$0" "$a" ' {} \;
}
@fongreecss
fongreecss / class.ExtClass.php
Last active January 6, 2017 14:04
ExtClass
<?php
if(!class_exists('ExtClass')) {
class ExtClass {
protected $data = array();
public function __set($name, $value) {
<?php
function sumniki_v_sicnike($orig) {
return str_replace(
array("š", "đ", "č", "ć", "ž", "Š", "Đ", "Č", "Ć", "Ž"),
array("s", "d", "c", "c", "z", "S", "D", "C", "C", "Z"),
$orig);
}
#install apache2
sudo apt-get install apache2 -y
sudo service apache2 start
#/var/www/html/
#A. open
#sudo nano /etc/apache2/apache2.conf
#A.1
#Timeout 30
#KeepAlive On
#MaxKeepAliveRequests 0