Skip to content

Instantly share code, notes, and snippets.

View antonmedv's full-sized avatar

Anton Medvedev antonmedv

View GitHub Profile
@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!
@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;
@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
@antonmedv
antonmedv / find.js
Created December 12, 2018 05:49
Search Snippet
global.find = re => json => [...find(json, re)]
function* find(v, regex, path = '') {
if (regex.test(path)) {
yield path
return
}
if (typeof v === 'undefined' || v === null) {
return
@TWal
TWal / si.bf
Created July 15, 2013 17:41
Brainfuck interpreter in brainfuck (si means "self-interpreter")
>>
>+[[-]+>>>+>++>- >++> ->+>+>+>>+++>+++ ++[<<< <
<<<<++ ++++> >+ ++>>>>++>++++++>-] >>+<<, [>>
-<<[> +<-]] >[<+>- ]>[<< <[<]<< ->>
>[>] >>-]< +++++ ++++[ <<[
>-<- ]>>>+ <<[> >-<<[<+>- ]]<[>+<-]>>> [-<<< <[< ]>[<+>-] >[>]> >>]< <<<[ <]<+>>[>]>[<+>- ]>[<+ >-]<- ]<[
-]+< <[-]> [>-<<<[-]>>[-]]>[ [-]<[ -]<< [>
@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
@hawkins
hawkins / screen.js
Created January 16, 2017 06:22
Node.js blessed screen - keep your output separate from your input!
/*
* I've used blessed to create a textbox at the bottom line in the screen.
* The rest of the screen is the 'body' where your code output will be added.
* This way, when you type input, your program won't muddle it with output.
*
* To try this code:
* - $ npm install blessed --save
* - $ node screen.js
*
* Key points here are:
@timdown
timdown / range_selection_save_restore.js
Last active July 4, 2024 09:50
Range and selection marker-element-based save and restore
/**
* This is ported from Rangy's selection save and restore module and has no dependencies.
* Copyright 2019, Tim Down
* Licensed under the MIT license.
*
* Documentation: https://github.com/timdown/rangy/wiki/Selection-Save-Restore-Module
* Use "rangeSelectionSaveRestore" instead of "rangy"
*/
var rangeSelectionSaveRestore = (function() {
var markerTextChar = "\ufeff";
@cmsx
cmsx / VideoThumb.php
Last active March 7, 2025 06:23
Класс для получения превью и информации о ролике RuTube, Vimeo, Youtube по ссылке.
<?php
/**
* Использование:
* $v = new VideoThumb($link);
* $v->getVideo(); //Ссылка на видео
* $v->getTitle(); //Название ролика
* $v->fetchImage($path) //Скачать самое большое превью ролика
*
* Прогнать тест:
@bcoe
bcoe / npm-top.md
Last active March 21, 2025 03:49
npm-top.md

npm Users By Downloads (git.io/npm-top)


npm users sorted by the monthly downloads of their modules, for the range May 6, 2018 until Jun 6, 2018.

Metrics are calculated using top-npm-users.

# User Downloads