Skip to content

Instantly share code, notes, and snippets.

@yuksbg
yuksbg / gist:f586035a9448702de9a0
Created March 30, 2011 13:57
jquery delay timer
function delayTimer(delay){
var timer;
return function(fn){
timer=clearTimeout(timer);
if(fn)
timer=setTimeout(function(){
fn();
},delay);
return timer;
}
@yuksbg
yuksbg / vbox7_get_flv
Created July 31, 2011 18:14
vbox7 - get flv
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://vbox7.com/play/magare.do");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
$data = array(
'onLoad' => '[type Function]',
'vid' => 'e0b5fa18'
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);
@yuksbg
yuksbg / gist:1136233
Created August 10, 2011 06:09
php_array_to_sql
function arrayToSql($table, $array, $insert = "INSERT INTO") {
if ($insert != "UPDATE") {
$insert = "INSERT INTO";
}
$columns = array ();
$data = array ();
foreach ( $array as $key => $value ) {
$columns [] = $key;
if ($value != "") {
@yuksbg
yuksbg / table_virtual_paging
Created June 17, 2012 08:44
Virtual pagination for table
/*
* author: yuks;
* last edit: 17.07.2012
*/
(function($) {
$.VirtualPaging = function(element, options) {
var defaults = {
perPage: 10,
'tablePagingPrefix':'stranicirane'
};
final ViewPager vp = (ViewPager) findViewById(R.id.top_imageViewPager);
vp.setPageMargin(-50);
vp.setHorizontalFadingEdgeEnabled(false);
vp.setFadingEdgeLength(30);
adapter = new ImageViewAdapterClubObekt(cnt, snimki_top);
vp.setAdapter(adapter);
vp.setOnTouchListener(new View.OnTouchListener() {
int dragthreshold = 30;
int downX;
int downY;
@yuksbg
yuksbg / MongoClient.php
Created April 24, 2014 19:49
Stub file for Zend/Eclipse PDT
<?php
/**
* MongoClient STUB File
*
* This class is *only* useful as a stub file to help your IDE provide autocompletion information. You should never
* require, include, or otherwise use this class in your application code.
*/
class MongoClient
{
const VERSION = '3.x';
import org.acra.*;
import org.acra.annotation.*;
@ReportsCrashes(
formKey = "test",
disableSSLCertValidation = true,
formUri = "https://bugtower.net/api/send/?api_key=YOUR_API_KEY",
httpMethod = org.acra.sender.HttpSender.Method.POST)
public class MyApplication extends Application {
@yuksbg
yuksbg / convert_to_jpg
Created October 29, 2014 10:11
Convert all png,gif files in directory to jpg with image magick
set -e
dir=/var/www/default/public_images
for ext in png gif; do
for i in `find "$dir" -type f -regex '.*'$ext `; do
( filename=${i%.*}
convert "$i" -quality 90 -strip "$filename.jpg"
echo "$filename" )
done
#!/bin/bash
set -e
username="backup"
password="NoFonE"
pcloud_username="pCloud username"
pcloud_password="pCloudoAuthToken"
import sys
import re
import glob
import os
result = {}
p = re.compile(ur'__\("(...+)"\)|__\(\'(...+)\'\)', re.MULTILINE | re.UNICODE)