Skip to content

Instantly share code, notes, and snippets.

View Wolg's full-sized avatar
👀

Stanislav Chistenko Wolg

👀
  • Pipedrive
  • Tallinn
View GitHub Profile
<?php
$routeCollection = Route::getRoutes();
$result = [];
foreach($routeCollection as $value) {
$result[] = [
'HTTP Method' => $value->getMethods()[0],
'Route' => $value->getPath(),
'Corresponding Action' => $value->getActionName(),
];
}
@Wolg
Wolg / chechen.php
Last active September 14, 2015 08:31
CHECHEN names seeder for Laravel 5
<?php
foreach(range(0, 50) as $i) {
$names = ['Али', 'Акболат', 'Ваха', 'Гази', 'Дага', 'Джамбек', 'Заур', 'Зураб', 'Ибрагим', 'Иса',
'Магомед', 'Муса', 'Назарбек', 'Рамзан', 'Сосланбек', 'Усман', 'Хаджи', 'Иван'];
$lnames = ['Айдамиров', 'Бокой', 'Дуарбеков', 'Муратов', 'Гоголадзе', 'Иванов'];
DB::table('users')->insert([
'name' => $names[array_rand($names)] . ' ' . $lnames[array_rand($lnames)],
'email' => str_random(10) . rand(1950, 1996) .'@чечня.рф',
'password' => bcrypt('secret'),
]);
@Wolg
Wolg / gist:f735bf6d26d335cb2eab
Created April 2, 2015 08:35
InnoDB Infrastructure Cleanup
To shrink ibdata1 once and for all you must do the following:
Dump (e.g., with mysqldump) all databases into a .sql text file (SQLData.sql is used below)
Drop all databases (except for mysql and information_schema) CAVEAT : As a precaution, please run this script to make absolutely sure you have all user grants in place:
mkdir /var/lib/mysql_grants
cp /var/lib/mysql/mysql/* /var/lib/mysql_grants/.
chown -R mysql:mysql /var/lib/mysql_grants
Login to mysql and run SET GLOBAL innodb_fast_shutdown = 0; (This will completely flush all remaining transactional changes from ib_logfile0 and ib_logfile1)
@Wolg
Wolg / pubsub.md
Created October 4, 2012 02:05 — forked from addyosmani/pubsub.md
Four ways to do Pub/Sub with jQuery 1.7 and jQuery UI (in the future)

#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here:

@Wolg
Wolg / redis_store.py
Created September 30, 2012 13:34 — forked from samuraisam/redis_store.py
Piston Redis OAuth Store
import hashlib
import redis
from django.db import DEFAULT_DB_ALIAS
from django.db.models import Q, signals as db_signals
from piston.models import Consumer, Token
from piston.store import DataStore as PistonDataStore
from mirrio.api._redis import redis
redis = redis.Redis(host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=settings.REDIS_DB)
@Wolg
Wolg / a.md
Created September 29, 2012 09:35 — forked from rkh/a.md

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
  • NBC
@Wolg
Wolg / git-recover-branch.md
Created September 5, 2012 06:15 — forked from jbgo/git-recover-branch.md
How to recover a git branch you accidentally deleted

Oops! I accidentally deleted a local git branch, and I haven't pushed it to a remote server yet. The branch has several important commits, and it hasn't been merged with any other branches yet. How do I find the missing branch?

1. Create a list of all dangling or unreachable commits.

$ git fsck --full --no-reflogs --unreachable --lost-found
unreachable tree 4a407b1b09e0d8a16be70aa1547332432a698e18
unreachable tree 5040d8cf08c78119e66b9a3f8c4b61a240229259
unreachable tree 60c0ce61b040f5e604850f747f525e88043dae12
unreachable tree f080522d06b9853a2f18eeeb898724da4af7aed9
@Wolg
Wolg / ML, Python and virtualenv.md
Created August 6, 2012 15:44 — forked from thesharp/ML, Python and virtualenv.md
Quick virtualenv fix on Mountain Lion

Quick virtualenv fix on Mountain Lion

Overview

It appears that Apple somehow broke Python in Mountain Lion, so even with the latest Command Line Tools and Xcode 4.4 virtualenv won't properly work. During virtual environment creation it will try to install easy_install inside /Library hierarchy. So let's give it a quick workaround. Let's install custom python into your $HOME-directory using pythonbrew!

Installing proper Command Line Tools

Without the Apple Mac Developer account you won't even see the proper download link for the latest CL Tools and the old one won't work on ML. So here's the link: http://goo.gl/iBTXh. It points towards the Apple website so don't worry.

@Wolg
Wolg / deploy.rb
Created July 6, 2012 09:06 — forked from bkutil/deploy.rb
Start and Stop tasks for resque workers and resque scheduler with capistrano deploy hook (without God)
after "deploy:symlink", "deploy:restart_workers"
after "deploy:restart_workers", "deploy:restart_scheduler"
##
# Rake helper task.
# http://pastie.org/255489
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/
def run_remote_rake(rake_cmd)
rake_args = ENV['RAKE_ARGS'].to_s.split(',')
@Wolg
Wolg / gist:2792487
Created May 26, 2012 05:55
Runnig percona-server on os x
cd /usr/local/Cellar/percona-server/5.5.23-25.3 ;
/usr/local/Cellar/percona-server/5.5.23-25.3/bin/mysqld_safe &