This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Http { | |
protected $_opt = array( | |
CURLOPT_USERAGENT=>'Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1', | |
CURLOPT_HEADER => 0, | |
CURLOPT_HTTPHEADER=>array('Expect: '), | |
CURLOPT_FRESH_CONNECT => 0, | |
CURLOPT_FORBID_REUSE => 0, | |
CURLOPT_BINARYTRANSFER => 1, | |
CURLOPT_RETURNTRANSFER => 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* thumbnails alignment bug fix, see https://github.com/twitter/bootstrap/issues/3494 */ | |
.row-fluid .thumbnails [class*="span"] { | |
margin-right: 2.5641%; | |
} | |
.row-fluid .thumbnails [class*="span"]:first-child { | |
margin-right: 2.5641%; | |
margin-bottom: 0; | |
} | |
/* | |
// bug fixed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* thumbnails alignment bug fix, see https://github.com/twitter/bootstrap/issues/3494 */ | |
.row-fluid .thumbnails [class*="span"] { | |
margin-left: 2.5641%; | |
} | |
.row-fluid .thumbnails [class*="span"]:first-child { | |
margin-left: 2.5641%; | |
margin-bottom: 0; | |
} | |
/* | |
>>> for n in range(1,13): m=12.0/n; print ".row-fluid .thumbnails span%d { width: %g%%;}" % (n,(100.0 - 2.5642*(m)) / m) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class MyViewHolder { ImageView logo; TextView name, foo, bar;} | |
public View getView (int position, View v, ViewGroup parent) { | |
MyType item=getItem(position); | |
MyViewHolder holder; | |
if (v==null) { | |
v = adapter.inflater.inflate(R.layout.my_row, null, false); | |
holder = new MyViewHolder(); | |
holder.logo=(ImageView) v.findViewById(R.id.logo); | |
holder.name=(TextView) v.findViewById(R.id.name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ajax_load(e){ | |
// styled after bootstrap-ajax < https://github.com/eldarion/bootstrap-ajax | |
var $e=$(e), src=e.getAttribute('data-src'), data={}; | |
var s,k,$target,f; | |
var verb=e.getAttribute('data-verb'); | |
if (!verb) verb='get'; | |
if (e.getAttribute('data-params')) { | |
$.extend(data, $.parseJSON(e.getAttribute('data-params')) ); | |
} | |
$.ajax({type:verb, url:src,data:data, dataType:'json', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.pull-start {float:right;} | |
.pull-end {float:left;} | |
.text-start {text-align:right;} | |
.text-end {text-align:left;} | |
.media > .pull-start {margin-left: 10px;} | |
.media > .pull-end {margin-right: 10px;} | |
.carousel-control.prev { right: 15px; left: auto; } | |
.carousel-control.next { left: 15px; right: auto; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_primes($n) { | |
$primes=array(); | |
$compo=array(); | |
for($i=2;$i<$n;++$i) $compo[$i]=false; | |
for($i=2;$i<$n;++$i) { | |
if ($compo[$i]) continue; | |
$primes[]=$i; | |
for($j=$i*2;$j<$n;$j+=$i) $compo[$j]=true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def get_primes(n): | |
compo=set() | |
for i in xrange(2, n): | |
if i in compo: continue | |
yield i | |
compo.update(xrange(i*2, n,i)) | |
def benchmark(f, n): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
/* | |
you can use it like this | |
PrimesIterator primes=new PrimesIterator(10000); | |
while(primes.hasNext()){ | |
System.out.println(primes.next()); | |
} | |
*/ | |
class PrimesIterator implements Iterator<Integer> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def get_primes(n): | |
compo=set() | |
for i in xrange(2, n): | |
if i in compo: continue | |
yield i | |
compo.update(xrange(i*2, n,i)) | |
def benchmark(f, n): |
OlderNewer