Recent posteets

Sort by: Date / Title /

  1. 6 days ago by joserobleda
    NO ACABADO
    1. // ==UserScript==
    2. // @name           Gmail Signature
    3. // @namespace      http*://mail.google.com*
    4. // @description    Añade automaticamente una firma a gmail
    5. // @include        http*://mail.google.com*
    6. // ==/UserScript==
    7.  
    8. //window._window = document.getElementById("canvas_frame").contentWindow;
    9. window.__change = function(data){
    10.  
    11.         if( data == "#compose" ){
    12.                 var canvasWindow = unsafeWindow.document.getElementById("canvas_frame").contentWindow;
    13.                 var composeWindow = canvasWindow.document.getElementsByTagName('iframe')[0].contentWindow;
    14.                 var composeBody = composeWindow.document.body;
    15.                 var currentValue = ( composeBody.innerHTML ) ? composeBody.innerHTML : "";
    16.                
    17.                 composeBody.innerHTML = 'MI TEXTO' + currentValue;
    18.         }
    19.         unsafeWindow.console.log(data);
    20.  
    21. };
    22. window.__check = function(){
    23.         try{
    24.                 if( unsafeWindow.__hash != unsafeWindow.location.hash ){
    25.                         unsafeWindow.__hash = unsafeWindow.location.hash;
    26.                         __change( unsafeWindow.__hash );
    27.                 }
    28.         }catch(e){};
    29. };
    30. window.__iniciar = function(){
    31.         try{
    32.                 if( unsafeWindow.gmonkey ){
    33.                         try{
    34.                                 if( document.getElementById("canvas_frame") ){
    35.                                         unsafeWindow.__hash = "";
    36.                                         //unsafeWindow.console.log( unsafeWindow.__hash  );
    37.                                         window.setInterval( function(){ __check(unsafeWindow);}, 1000 );
    38.                                 }
    39.                         }catch(e){};   
    40.                 } else {
    41.                         window.setTimeout( __iniciar, 1400 );
    42.                 }
    43.  
    44.         }catch(e){};
    45. };
    46. document.addEventListener("load", function(){
    47.         window.setTimeout(function(){
    48.                 __iniciar();
    49.         }, 1000);
    50. }, true);
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2042"></script>
  2. 1 week ago by spirit
    Prevents jobs to collide if they take longer to run than the frequency itself
    1. $fp = fopen('/tmp/lock.txt', 'r+')
    2.  
    3. if(!flock($fp, LOCK_EX | LOCK_NB)) { 
    4.    echo 'Unable to obtain lock'
    5.    exit(-1)
    6. } 
    7.    
    8. /* ... */ 
    9.  
    10. fclose($fp);
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2040"></script>
  3. 1 week ago by spirit
    it's also possibl with a .htaccess file and "deny from all " in that file
    1. if (isset($_SERVER['REMOTE_ADDR'])) die('Permission denied.');
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2039"></script>
  4. sponsorised links
  5. 2 weeks ago by sx
    1. echo substr($filename, strripos($filename, '.'),strlen($filename));
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2038"></script>
  6. 2 weeks ago by spirit
    1. #someElement { 
    2.   background: red; /* modern browsers */ 
    3.   *background: green; /* IE 7 and below */ 
    4.   _background: yellow; /* IE6 exclusively */ 
    5. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2037"></script>
  7. 3 weeks ago by macks
    1. cName = ['funciton','bcp','interbank','sheraton']
    2.     cPhone = ['65465465','4546545','56465465','545454545']
    3.     cRuc = [5465463545,546546546,5245454,9898998]
    4.  
    5.     store = [cName,cPhone,cRuc]
    6.    
    7.     l = []
    8.     i = 0
    9.     for s in store:
    10.         cname = store[0][i]
    11.         cphone = store[1][i]
    12.         cruc = store[2][i]
    13.         l.append({'cname': cname, 'phone':cphone, 'ruc':cruc})
    14.         i = i+1
    15.  
    16. savelog(l)
    17. [{
    18.   'phone': '65465465',
    19.   'cname': 'funciton',
    20.   'ruc': 5465463545L
    21. },
    22. {
    23.   'phone': '4546545',
    24.   'cname': 'bcp',
    25.   'ruc': 546546546
    26. },
    27. {
    28.   'phone': '56465465',
    29.   'cname': 'interbank',
    30.   'ruc': 5245454
    31. }]
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2035"></script>
  8. 3 weeks ago by mkrobot
    1. #include<iostream>
    2. using namespace std;
    3.  
    4. struct element{
    5.         int label;
    6.         bool koristen;
    7. };
    8.  
    9. struct BinaryTree{
    10.         element elementi[ 2000 ];
    11. };
    12.  
    13. void InitB( int x, BinaryTree* stablo ){
    14.         for( int i = 0; i < 2000; i++ )
    15.                         elementi[ i ].koristen = false;
    16.         stablo->elementi[ 1 ].koristen = true;
    17.         stablo->elementi[ 1 ].label = x;
    18. }
    19.  
    20. int RootB( BinaryTree* stablo ){
    21.         if( stablo->elementi[ 1 ].koristen )
    22.                 return 1;                                   
    23.         return 0;                                          
    24. }
    25.  
    26. int LabelB( int n, BinaryTree* stablo ){
    27.         return stablo->elementi[ n ].label;
    28. }
    29.  
    30. void ChangeLabelB( int x, int n, BinaryTree* stablo ){
    31.         stablo->elementi[ n ].label = x;
    32. }
    33.  
    34. void CreateLeftB( int x, int n, BinaryTree* stablo ){
    35.         if( stablo->elementi[ 2*n ].koristen )
    36.                 cout << "ERROR!" << endl;
    37.         else{
    38.                 stablo->elementi[ 2*n ].koristen = true;
    39.                 stablo->elementi[ 2*n ].label = x;
    40.         }
    41. }
    42.  
    43. void CreateRightB( int x, int n, BinaryTree* stablo ){
    44.         if( stablo->elementi[ 2*n+1 ].koristen )
    45.                 cout << "ERROR!" << endl;
    46.         else{
    47.                 stablo->elementi[ 2*n+1 ].koristen = true;
    48.                 stablo->elementi[ 2*n+1 ].label = x;
    49.         }
    50. }
    51.  
    52.  
    53.  
    54. int LeftChildB( int n, BinaryTree* stablo ){
    55.         if( stablo->elementi[ 2*n ].koristen ) /
    56.                 return (2*n );
    57.         else
    58.         return 0;
    59. }
    60.  
    61.  
    62. int RightChildB( int n, BinaryTree* stablo ){
    63.         if( stablo->elementi[ 2*n+1 ].koristen )
    64.                 return (2*n+1);
    65.         else
    66.         return 0;
    67. }
    68.  
    69.  
    70.  
    71. void DeleteB( int n, BinaryTree* stablo ){
    72.         if( n ){
    73.                 DeleteB( LeftChildB( n, stablo ), stablo );
    74.                 DeleteB( RightChildB( n, stablo ), stablo );
    75.                 stablo->elementi[ n ].koristen = false;
    76.         }
    77. }
    78.  
    79. bool ExistsLeftChildB( int n, BinaryTree* stablo ){
    80.         if(LeftChildB( n, stablo ) != 0)
    81.         return true;
    82.         else
    83.                 return false;
    84. }
    85.  
    86. bool ExistsRightChildB( int n, BinaryTree* stablo ){
    87.         if(RightChildB( n, stablo ) != 0)
    88.         return true;
    89.         else
    90.                 return false;
    91. }
    92.  
    93. int ParentB( int n, BinaryTree* stablo ){
    94.         if( n == 1 )
    95.                 return 0;
    96.         else
    97.                 return n/2;
    98. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2034"></script>
  9. 3 weeks ago by mkrobot
    1. #include<iostream>
    2. #include<cstdlib>
    3. using namespace std;
    4.  
    5. struct element{
    6.         int label;
    7.         element *lijevo,*desno;
    8. };
    9.  
    10. struct BinaryTree{
    11.         element *korijen;
    12. };
    13.  
    14. struct stack{
    15.         element * elementi[ 10000 ];
    16.         int top;
    17. };
    18.  
    19. void InitS( stack& S ){
    20.         S.top = 9999;
    21. }
    22.  
    23. bool IsEmptyS( stack& S ){
    24.         return S.top == 9999;
    25. }
    26.  
    27. element * TopS( stack& S ){
    28.         if( !IsEmptyS( S ) )
    29.                 return S.elementi[ S.top+1 ];
    30.         else
    31.                 return 0;
    32. }
    33.  
    34. void PushS( element * x, stack& S ){
    35.    if( S.top >= 0 )
    36.       S.elementi[ S.top-- ] = x;
    37.    else
    38.       exit( 1 );
    39. }
    40.  
    41. void PopS( stack& S ){
    42.    if( !IsEmptyS( S ) )
    43.       S.top++;
    44.    else
    45.       exit( 1 );
    46. }
    47.  
    48. void InitB( int x, BinaryTree* stablo ){
    49.         stablo->korijen = new element;
    50.         stablo->korijen->lijevo = stablo->korijen->desno = 0;
    51.         stablo->korijen->label = x;
    52. }
    53.  
    54. element * RootB( BinaryTree* stablo ){
    55.         if( stablo )
    56.                 return stablo->korijen;
    57.         return 0;
    58. }
    59.  
    60. int LabelB( element * n, BinaryTree* stablo ){
    61.         return n->label;
    62. }
    63.  
    64. void ChangeLabelB( int x, element * n, BinaryTree* stablo ){
    65.         n->label = x;
    66. }
    67.  
    68. element * LeftChildB( element * n, BinaryTree* stablo ){
    69.         if( n->lijevo )
    70.                 return n->lijevo;
    71.         return 0;
    72. }
    73.  
    74. element * RightChildB( element * n, BinaryTree* stablo ){
    75.         if( n->desno != 0 )
    76.                 return n->desno;
    77.         return 0;
    78. }
    79.  
    80. void CreateLeftB( int x, element * n, BinaryTree* stablo ){
    81.         if( n->lijevo != 0)
    82.                 cout << "Error!" << endl;
    83.         else{
    84.                 element * novi = new element; 
    85.                 novi->label = x;         
    86.                 novi->lijevo = novi->desno = 0;
    87.                 n->lijevo = novi;
    88.         }
    89. }
    90.  
    91. void CreateRightB( int x, element * n, BinaryTree* stablo ){
    92.         if( n->desno != 0)
    93.                 cout << "Error!" << endl;
    94.         else{
    95.                 element * novi = new element;
    96.                 novi->label = x;
    97.                 novi->lijevo = novi->desno = 0;
    98.                 n->desno = novi;
    99.         }
    100. }
    101.  
    102. element * ParentB( element * n, BinaryTree* stablo ){
    103.         element * tekuci;
    104.         bool nadjen=false;
    105.         stack S;
    106.         InitS(S);
    107.         PushS( stablo->korijen,S);
    108.         while((!IsEmptyS(S)) && (!nadjen)) {
    109.                 tekuci=TopS(S)
    110.                 PopS( S );                 
    111.                 if ((tekuci->lijevo!=n) && (tekuci->desno!=n)){
    112.                         if (tekuci->lijevo!=0) PushS(tekuci->lijevo,S);
    113.                         if (tekuci->desno!=0) PushS(tekuci->desno,S);
    114.                 }
    115.                 else
    116.                         nadjen = true;
    117.         }
    118.         if( nadjen )
    119.                 return tekuci;
    120.         else
    121.                 return 0;
    122. }
    123.  
    124. void DeleteElement( element * n, BinaryTree* stablo ){
    125.         if( n->lijevo ) DeleteElement( n->lijevo, stablo );
    126.         if( n->desno ) DeleteElement( n->desno, stablo );
    127.         delete n;
    128. }
    129.  
    130. void DeleteB( element * n, BinaryTree* stablo ){
    131.         element * l = n;
    132.         if( n->lijevo ) DeleteElement( n->lijevo, stablo );
    133.         if( n->desno ) DeleteElement( n->desno, stablo );
    134.         l = ParentB( n, stablo );
    135.         if( l != 0 ){
    136.                 if( l->lijevo == n )
    137.                         l->lijevo = 0;
    138.                 else
    139.                         l->desno = 0;
    140.         delete n;
    141.         }
    142.         else{
    143.                 delete stablo->korijen;
    144.                 stablo->korijen = 0;
    145.         }
    146. }
    147.  
    148. bool ExistsLeftChildB( element * n, BinaryTree* stablo ){
    149.         if( LeftChildB( n, stablo ) != 0 )
    150.                 return true;
    151.         else
    152.                 return false;
    153. }
    154.  
    155. bool ExistsRightChildB( element * n, BinaryTree* stablo ){
    156.         if( RightChildB( n, stablo ) != 0 )
    157.                 return true;
    158.         else
    159.                 return false;
    160. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2033"></script>
  10. 4 weeks ago by anisambol
    struct elmnt {
           int vrij;
           bool juzd;
    };
    
    struct binstab {
           struct elmnt elmnti[10000];
    };
    
    typedef struct binstab *binstablo;
    typedef int chvor;
    
    chvor InitB(chvor ruut, binstab *binstablo){
         int i;
         for(i=0; i<10000;i++)
                  binstablo->elmnti[i].juzd=false;
         binstablo->elmnti[0].vrij=ruut;
         binstablo->elmnti[0].juzd=true;   
         return 0; 
    }
    
    chvor RootB(binstab *binstablo){
         if(binstablo->elmnti[0].juzd==true) return 0;
         else
             return -1;
    }
    
    chvor LeftChildB(chvor ind, binstab *binstablo){
         if(binstablo->elmnti[(ind*2)+1].juzd==true) return (ind*2)+1;
         else
             return -1; 
    }
    
    chvor RightChildB(chvor ind, binstab *binstablo){
              if(binstablo->elmnti[(ind*2)+2].juzd==true) return (ind*2)+2;
              else
                  return -1;
    }
    
    chvor ParentB(chvor ind, binstab *binstablo){
              if(ind < 1) return -1;
              if(binstablo->elmnti[int((ind-1)/2)].juzd==true) return int((ind-1)/2);
              else
                  return -1;
    }
    
    chvor CreateLeftB(int vrij, chvor ind, binstab *binstablo){
         int x=(ind*2)+1;
         if(LeftChildB(ind, binstablo)==-1){
                               binstablo->elmnti[x].vrij=vrij;
                               binstablo->elmnti[x].juzd=true;
         }
         else{
              cout<<"Vec postoji lijevo dijete."<<endl;
         }
    }
    
    chvor CreateRightB(int vrij, chvor ind, binstab *binstablo){
              int x=(ind*2)+2;
              if(RightChildB(ind, binstablo)==-1){
                                     binstablo->elmnti[x].vrij=vrij;
                                     binstablo->elmnti[x].juzd=true;                       
              }
              else{
                   cout<<"Vec postoji desno dijete."<<endl;
              }
    }
    
    int LabelB(chvor ind, binstab *binstablo){
        if(binstablo->elmnti[ind].juzd==true) return binstablo->elmnti[ind].vrij;
        else{
            cout<<"Ovaj cvor nema vrijednost."<<endl;
        }
    }
    
    void ChangeLabelB(int vrij, chvor ind, binstab *binstablo){
         if(binstablo->elmnti[ind].juzd==true){
             binstablo->elmnti[ind].vrij=vrij;
         }
         else{
              cout<<"Ovaj cvor nema vrijednost."<<endl;
         }
    }
    
    void DeleteB(chvor ind, binstab *binstablo){
         if(binstablo->elmnti[(ind*2)+1].juzd==true){
              DeleteB((ind*2)+1, binstablo);
         }
         if(binstablo->elmnti[(ind*2)+2].juzd==true){
              DeleteB((ind*2)+2, binstablo);
         }
         binstablo->elmnti[ind].juzd=false;
    }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2031"></script>
  11. 4 weeks ago by anisambol
    struct elmnt {
           int vrij;
           struct elmnt *left,*right;
    };
    
    typedef struct elmnt *chvor;
    typedef struct elmnt *binstablo;
    
    void InitB(int vrij, binstablo B){
         chvor nuevo;
         nuevo= new elmnt;
         nuevo->vrij=vrij;
         nuevo->left=NULL;
         nuevo->right=NULL;
         B=nuevo;
    }
    
    chvor RootB(binstablo B){
         if(B==NULL) cout<<"Nema korijena stabla."<<endl;
         return B;
    }
    
    chvor LeftChildB(chvor C, binstablo B){
         return C->left;
    }
    
    chvor RightChildB(chvor C, binstablo B){
         return C->right;
    }
    
    chvor ParentB(chvor C, binstablo B){
         if(C==B) return NULL;
         chvor starci;
         if(B->left!=NULL){ 
                     if(B->left==C) return B->left;
                     starci=ParentB(C,B->left);
         }
         if(B->right!=NULL){
                    if(B->right==C) return B->right;
                    starci=ParentB(C,B->right);
         }
         return starci;
    }
    
    void CreateLeftB(int vrij, chvor C, binstablo B){
         chvor nuevo;
         nuevo = new elmnt;
         if(LeftChildB(C, B)) cout<<"Vec postoji lijevo dijete."<<endl;
         else{
              nuevo->vrij=vrij;
              nuevo->left=NULL;
              nuevo->right= NULL;
              C->left=nuevo;
         }
    }
    
    void CreateRightB(int vrij, chvor C, binstablo B){
         chvor nuevo;
         nuevo= new elmnt;
         if(RightChildB(C, B)) cout<<"Vec postoji desno dijete."<<endl;
         else{
              nuevo->vrij=vrij;
              nuevo->left=NULL;
              nuevo->right=NULL;
              C->right=nuevo;
         }
    }
    
    int LabelB(chvor C, binstablo B){
        if(C==NULL){
                    cout<<"Nepostojeci cvor."<<endl;
                    return -1;
        }
        return B->vrij;
    }
    
    void ChangeLabelB(int vrij, chvor C, binstablo B){
         if(C==NULL) cout<<"Nepostojeci cvor."<<endl;
         else{
              B->vrij=vrij;
         }
    }
    
    void DeleteB(chvor C, binstablo B){
         if (C->left!=NULL) DeleteB(C->left, B);
         if (C->right!=NULL) DeleteB(C->right, B);
         delete C;
    }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2030"></script>

First / Previous / Next / Last / Page 1 of 30 (298 posteets)