Skip to content

Instantly share code, notes, and snippets.

git log --pretty=format:'%s' | tr '[:upper:]' '[:lower:]' | tr '[:space:]' '\n' | sort | uniq -c | sort -nr | grep -iE "(fuck|shit|bitch|damn|pis)"
<?php
//Define options
$options = new ArrayObject(array(
'a',
'b',
'c',
'd',
'e',
'f'
^\s*($|#|\w+\s*=|(\*(?:\/\d+)?|(?:[0-5]?\d)(?:-(?:[0-5]?\d)(?:\/\d+)?)?(?:,(?:[0-5]?\d)(?:-(?:[0-5]?\d)(?:\/\d+)?)?)*)\s+(\*(?:\/\d+)?|(?:[01]?\d|2[0-3])(?:-(?:[01]?\d|2[0-3])(?:\/\d+)?)?(?:,(?:[01]?\d|2[0-3])(?:-(?:[01]?\d|2[0-3])(?:\/\d+)?)?)*)\s+(\*(?:\/\d+)?|(?:0?[1-9]|[12]\d|3[01])(?:-(?:0?[1-9]|[12]\d|3[01])(?:\/\d+)?)?(?:,(?:0?[1-9]|[12]\d|3[01])(?:-(?:0?[1-9]|[12]\d|3[01])(?:\/\d+)?)?)*)\s+(\*(?:\/\d+)?|(?:[1-9]|1[012])(?:-(?:[1-9]|1[012])(?:\/\d+)?)?(?:,(?:[1-9]|1[012])(?:-(?:[1-9]|1[012])(?:\/\d+)?)?)*|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\s+(\*(?:\/\d+)?|(?:[0-6])(?:-(?:[0-6])(?:\/\d+)?)?(?:,(?:[0-6])(?:-(?:[0-6])(?:\/\d+)?)?)*|mon|tue|wed|thu|fri|sat|sun)\s+|(@reboot|@yearly|@annually|@monthly|@weekly|@daily|@midnight|@hourly)\s+)([^\s]+)\s+(.*)$
@mewm
mewm / gist:7759143
Last active December 30, 2015 01:59
<?php
#On top of routes (got it in a service provider, but put it here because I have to debug)
App::bind('\Mewm\Shop\Storage\Category\CategoryRepository', function($app) {
return new \Mewm\Shop\Storage\Category\CategoryEloquent();
});
......
#CategoryEloquent looks like this
namespace Mewm\Shop\Storage\Category;
@mewm
mewm / foo.py
Last active January 3, 2016 00:59
#!/usr/bin/env python
"""
Create, read, update, append and delete file test
"""
import sys, os
class FileOperation():
@mewm
mewm / foo.sql
Last active August 29, 2015 13:56
SELECT
m.id,
u.user_id
FROM
matches m
INNER JOIN (
SELECT
match_id
FROM
match_user
@mewm
mewm / _etc_sudoers
Created April 24, 2014 20:47
Ubuntu 14 default sudoers file
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
@mewm
mewm / loop.js
Created May 17, 2014 13:03
Syncrounous loop in javascript without dependencies
var page = 2;
var last_page = 100;
(function loop() {
if (page <= last_page) {
request("/data?page=" + page, function (error, response, body) {
if (!error && response.statusCode == 200) {
store_data(body)
}
page++;
update table_with_posts p set col_to_update = (
select
col_to_update_from
from
table_to_update_from
where
table_to_update_from.id in (<comma separated ids or select id statement)
order by rand()
limit 1
) where id in (<ids to posts you wanna update>)
@mewm
mewm / config.js
Created February 18, 2015 20:15
Generic config.js file for Ghost configurable with environment variables
var config,
url = require('url'),
path = require('path');
function getDatabase() {
var db_config = {};
if (process.env['DB_CLIENT']) {
db_config['client'] = process.env['DB_CLIENT'];
} else {
return {