Skip to content

Instantly share code, notes, and snippets.

View antonmedv's full-sized avatar

Anton Medvedev antonmedv

View GitHub Profile
@ziadoz
ziadoz / awesome-php.md
Last active July 13, 2024 05:29
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@fiveminuteargument
fiveminuteargument / visit-nodes-iterative.js
Last active February 24, 2016 08:27
Iterative approach to walking a DOM tree in javascript
function visit_nodes_iterative(node) {
node = node || document;
do
{
/* Do something with node here */
node = node.firstChild || node.nextSibling || function() {
while ((node = node.parentNode) && !node.nextSibling);
return node ? node.nextSibling : null;
@ZipoKing
ZipoKing / symfony2_nginx.conf
Created May 3, 2012 09:32
Sample nginx configuration for Symfony2
server {
listen 80;
server_name symfony2;
root /var/www/symfony2/web;
error_log /var/log/nginx/symfony2.error.log;
access_log /var/log/nginx/symfony2.access.log;
# strip app.php/ prefix if it is present
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@paulmillr
paulmillr / active.md
Last active July 15, 2024 10:55
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 1000)
@jboner
jboner / latency.txt
Last active July 23, 2024 14:12
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@cmsx
cmsx / VideoThumb.php
Last active February 27, 2024 16:38
Класс для получения превью и информации о ролике RuTube, Vimeo, Youtube по ссылке.
<?php
/**
* Использование:
* $v = new VideoThumb($link);
* $v->getVideo(); //Ссылка на видео
* $v->getTitle(); //Название ролика
* $v->fetchImage($path) //Скачать самое большое превью ролика
*
* Прогнать тест:
@XueshiQiao
XueshiQiao / gource.sh
Last active November 10, 2019 15:56 — forked from cgoldberg/gource.sh
Generate a MP4 Video for your Git project commits using Gource!
# 1.install gource using HomeBrew
$ brew install gource
# 2.install avconv
git clone git://git.libav.org/libav.git
cd libav
# it will take 3-5 minutes to complie, be patient.
./configure --disable-yasm
make && make install
@TWal
TWal / si.bf
Created July 15, 2013 17:41
Brainfuck interpreter in brainfuck (si means "self-interpreter")
>>
>+[[-]+>>>+>++>- >++> ->+>+>+>>+++>+++ ++[<<< <
<<<<++ ++++> >+ ++>>>>++>++++++>-] >>+<<, [>>
-<<[> +<-]] >[<+>- ]>[<< <[<]<< ->>
>[>] >>-]< +++++ ++++[ <<[
>-<- ]>>>+ <<[> >-<<[<+>- ]]<[>+<-]>>> [-<<< <[< ]>[<+>-] >[>]> >>]< <<<[ <]<+>>[>]>[<+>- ]>[<+ >-]<- ]<[
-]+< <[-]> [>-<<<[-]>>[-]]>[ [-]<[ -]<< [>
@antonmedv
antonmedv / Example.php
Created October 21, 2013 10:11
Example of getters and setters in PHP.
<?php
$foo = new Foo();
$foo->id = 1;
$foo->text = 'Hello';
echo $foo->id; // 1
echo $foo->text; // Hello World!