Skip to content

Instantly share code, notes, and snippets.

@amici-fos
amici-fos / slider.css
Last active September 9, 2016 07:44
slider.css is helpful to change the visual presentation of list items
ul{height: 150px;width:100%;overflow: hidden;}
//height of parent is slider above than height of child and overflow in horizontal direction hidden
li{padding: 5px; margin: 5px;}
ul li{display: inline-block; list-style:table-cell;height:115px;}
ul li:hover{border:solid green 5px;}
setInterval(function(){ ($("ul.slider>li").first()).insertAfter($("ul>li").last()) }, 3000);
//setInterval is timing loop
if ($( ".subtabs" )){
$( window ).scroll(function() {
var p = $( ".subtabs" );
var offset = p.offset();
var viewableOffset = p.offset().top - $(window).scrollTop();
console.log($(window).scrollTop());
if(viewableOffset<=20){
p.addClass("fixed");
}
if ($(window).scrollTop()<60){
$("input[name='options']").on("click",function(){
$(".active").each(function(){
$(this).removeClass("active");
});
$(this).parent().addClass("active");
$("a.mainlink").each(function(){
k=$(this).attr("href");m="https://www.amicicorp.net"+location.pathname;
if(k==m){$(this).parent().addClass('active2');}
})
function ajaxUpload(a){
files=a.files[0];//get file
formdata=new FormData(); // created http transport object
formdata.append("files",files) ;// append a new value and this is going to send as post
ajax=new XMLHttpRequest();
ajax.upload.addEventListener("progress",console.log(1),false)
ajax.open("POST","manage.php/upload");
ajax.send(formdata);
function progressHandler(e){
console.log(e.loaded/e.total);
function UploadFile(file) {
var xhr = new XMLHttpRequest();
xhr.upload.addEventListener("progress", function(e) {
var pc = parseInt((e.loaded / e.total * 100));
document.getElementById("progressbar").value= pc;
document.getElementById("progressbarstatus").innerHTML= pc +"% upload done";
}, false);
xhr.onreadystatechange = function(e) {
if (xhr.readyState ==200) {
console.log(e);
// clear the screen for testing
document.body.innerHTML = '';
var nums = [1,2,3];
// Let's loop over the numbers in our array
for (var i = 0; i < nums.length; i++) {
// This is the number we're on...
var num = nums[i];
// clear the screen for testing
document.body.innerHTML = '';
var nums = [1,2,3];
// Let's loop over the numbers in our array
for (var i = 0; i < nums.length; i++) {
// This is the number we're on...
var num = nums[i];
@amici-fos
amici-fos / export path ( Linux)
Created November 20, 2016 05:40
make executable available
PATH=$PATH:/data/myscripts
export PATH