Skip to content

Instantly share code, notes, and snippets.

@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>)
stdClass Object
(
[accuracylevel] => ZIP
[parcelshops] => stdClass Object
(
[PakkeshopData] => Array
(
[0] => stdClass Object
(
[Number] => 97853
var elixir = require('laravel-elixir');
elixir(function(mix)
{
// LESS
mix.less([
// Bootstrap
'bootstrap.less',
$this->app->bind(
'Esub\Infrastructure\Data\Campaign\CampaignRepository',
function() {
return new CampaignCacheDecorator(App::make('Esub\Infrastructure\Data\Campaign\CampaignDb'));
}
);
@mewm
mewm / assignment.md
Created June 23, 2015 09:59
miinto dev assignment

#Assignment Spend a few hours starting a small blog application. The objective is not to finish the assignment, but just the overall idea and fundaments of the project. Feel free to use any tools of your likes, and feel free to use interfaces and psuedo code to cover the most trivial implementations (because you're probably already sick and tired of writing simple queries). By psuedo code, I mean that you don't have to spend time writing trivial code like CRUD operations from storage. You can simply just define the methods and write a small comments inside to elaborate its responsibility. This is for us to get an idea how you like to partition your code. Please add at least one unit test.

For example:

class Article
---
- hosts: papi_nodes
sudo: true
gather_facts: yes
vars_files:
- ../vars/local.yml
tasks:
- shell: ls -A /var/www/miinto-papi
register: papidir
roles:
@mewm
mewm / pulse.scss
Created August 13, 2015 12:51
Pulsing
@-webkit-keyframes pulse-animation {
0% { -webkit-transform: scale(1); }
50% { -webkit-transform: scale(1.5); }
100% { -webkit-transform: scale(1); }
}
.pulse {
-webkit-animation-name: 'pulse-animation';
-webkit-animation-duration: 2000ms;
-webkit-animation-iteration-count: infinite;