Skip to content

Instantly share code, notes, and snippets.

View meeDamian's full-sized avatar
👨‍💻
Lightning Networking

Damian Mee meeDamian

👨‍💻
Lightning Networking
View GitHub Profile
@meeDamian
meeDamian / gist:1554720
Created January 3, 2012 12:16
[ PHP | stupidfix ] Stupid includes

Crazy includes

If you try to do something only if some include is loaded successfully you may try to do:

if(@include('some/file.inc')) { do_sth(); }

and it will most likely work, but sometimes you want to add extra parameter to this like this:

if(@include('some/file.inc') and $feature_enabled) { do_sth(); }
<!--/* OpenX Interstitial or Floating DHTML Tag v2.8.7 */-->
<script type='text/javascript'><!--//<![CDATA[
var ox_u = 'http://arp.ovh.zjednoczenie.com/www/delivery/al.php?zoneid=1&target=_blank&layerstyle=geocities&align=right&padding=2&closetext=%5BClose%5D';
if (document.context) ox_u += '&context=' + escape(document.context);
document.write("<scr"+"ipt type='text/javascript' src='" + ox_u + "'></scr"+"ipt>");
//]]>--></script>
def fib( n ):
if (n==0): return 0
elif(n==1): return 1
else: return fib(n-1) + fib(n-2)
print(fib(int(input())))
@meeDamian
meeDamian / gist:1854102
Created February 17, 2012 15:47
Service in TabActivity - TabActivity
package com.example;
import com.example.app.NewsActivity;
import com.example.app.services.LocalService;
import android.app.TabActivity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.res.Resources;
@meeDamian
meeDamian / gist:1854112
Created February 17, 2012 15:51
Service in TabActivity - Service
package com.example.app.services;
import java.net.MalformedURLException;
import java.net.URL;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@meeDamian
meeDamian / gist:1854124
Created February 17, 2012 15:54
Service in TabActivity - News Activity
package com.example.app;
import com.example.R;
import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;
@meeDamian
meeDamian / secure_hash.php
Created February 25, 2012 23:37
[ PHP | lib ] quite a hash function
<?
// put this to libs file
function make_hash( $pass, $salt, $email, $linear=false ) {
$numb = "";
foreach( str_split($salt) as $char ) if( is_numeric( $char )) $numb .= $char;
mt_srand( (int)$numb );
$algs = array('whirlpool', 'sha512', 'sha384', 'ripemd320', 'snefru256', 'gost', 'snefru', 'ripemd256', 'sha256', 'sha224');
$(this).stop().animate({backgroundColor:"#f08080"}, 500, 'easeOutCirc',function(){
$(this).animate({backgroundColor:"#fff"},1700,'easeOutCirc');
@meeDamian
meeDamian / favicon.js
Created March 8, 2012 22:45
[jQuery plugin] favicon prepender
// jQuery plugin prepending chosen <a>'s with favicon
(function($){$.fn.preFav=function(){$(this).css('background','url('+$(this).attr('href').replace(/^(http:\/\/[^\/]+).*$/,'$1') +'/favicon.ico'+') no-repeat 0 0').css('padding-left','18px');};})(jQuery);
// usage:
$('a.fav').preFav();
#!/bin/sh /etc/rc.common
START=91
COMPYTH="python /root/pyLoad/pyLoadCore.py --configdir=/root/.pyload"
EXTRA_COMMANDS="status"
start() {
# echo "Starting PyLoad"
$COMPYTH --daemon