Skip to content

Instantly share code, notes, and snippets.

@RemeJuan
RemeJuan / db.lookup.js
Created May 18, 2017 05:19
Mongo find all duplicated by 'name'
db.getCollection('events').aggregate([
{$group:{"_id":"$name","name":{$first:"$name"},"count":{$sum:1}}},
{$match:{"count":{$gt:1}}},
{$project:{"name":1,"_id":0}},
{$group:{"_id":null,"duplicateNames":{$push:"$name"}}},
{$project:{"_id":0,"duplicateNames":1}}
])
<template>
<form novalidate @submit.stop.prevent="submit">
<label>Search term...</label>
<input v-model="term.value"></input>
</form>
</template>
<script>
export default {
name: 'Search',
<template>
<div>
<header-bar></header-bar>
<main>
<search-bar :submit="search" :term="searchTerm"></search-bar>
<list-data v-for="item in list" :event="item"></list-item>
</main>
<footer-bar></footer-bar>
</div>
</template>
@RemeJuan
RemeJuan / main.js
Last active November 15, 2016 06:06
Aurelia: First Impressions #2
// Binding data
import { bindable } from 'aurelia-framework';
import { moment } from 'moment';
export class OtherComponent{
//Binding data reference
@bindable data;
//Change handler (not required).
dataChanged(data) {
@RemeJuan
RemeJuan / main.html
Last active November 15, 2016 06:08
Aurelia: First Impressions #1
<template>
<!--Importing a component into a template-->
<require from="component/component"></require>
<require from="other-component/other-component.html"></require>
<!--Displaying/rendering the imported component.-->
<component></component>
<other-component data-bind="stuff"></other-component>
</template>

Keybase proof

I hereby claim:

  • I am RemeJuan on github.
  • I am remejuan (https://keybase.io/remejuan) on keybase.
  • I have a public key whose fingerprint is 9FE2 6A96 E3E3 34A0 E323 8ED6 A932 9EF4 E20C E8E9

To claim this, I am signing this object:

@RemeJuan
RemeJuan / style.css
Created April 4, 2016 06:31
Better responsive table
@media only screen and (max-width: 800px) {
.enhanced-responsive-table {
table, thead, tbody, th, td, tr {
display: block;
}
thead tr {
position: absolute;
top: -9999px;
left: -9999px;
@RemeJuan
RemeJuan / wercker.yml
Created March 30, 2016 12:50
Complete docker sample file for automated deployment to digital ocean.
box: node
build:
steps:
- npm-install
deploy:
steps:
- script:
name: install nodemon
@RemeJuan
RemeJuan / browser_test.js
Last active August 29, 2015 14:07
Detect browser version using HTTP headers, add a class to the body tag as well as set a variable.
//Check browser version and apply classes to body where applicable
var body = document.getElementsByTagName('body')[0],
browserName,
browserVersion,
userAgent = navigator.appVersion.toLowerCase();
if (userAgent.indexOf("msie 8.") !== -1)
{
body.classList.add('ie8');
browserName = 'ie';
@RemeJuan
RemeJuan / ajax_search.js
Last active August 29, 2015 14:06
AJAX search query returning JSON data from DB to populate UL
//Function to handle database search and process results
function getCustomers(searchQuery) {
$.ajax({
type: 'POST',
url: '/com/cfcs/SearchServices.cfc?method=searchCustomerByName&customerName=' + searchQuery + '&returnFormat=json',
datatype: 'json',
cache: false,
success: function(response)
{
var searchResults = response.DATA,