Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Jefferson Raga Salunga jrsalunga

💭
I may be slow to respond.
View GitHub Profile
@jrsalunga
jrsalunga / App\Http\Controllers\Auth\AuthController.php
Created Sep 15, 2015
Laravel 5.1 - Log in with Username or Email
View App\Http\Controllers\Auth\AuthController.php
<?php
/**
* This snippet goes into your
* \app\Http\Controllers\Auth\AuthController.php
*
*
*/
/**
* Handle a login request to the application.
*
View designer.html
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
View designer.html
<link rel="import" href="../core-pages/core-pages.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-input/core-input.html">
<polymer-element name="my-element">
<template>
<style>
View designer.html
<link rel="import" href="../topeka-elements/theme.html">
<link rel="import" href="../topeka-elements/topeka-resources.html">
<link rel="import" href="../topeka-elements/topeka-app.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
View modal-populate
if(k.match(/id$/) && k.length > 2){ // eg: "userid" no "id"
var s = k.split('id')[0];
this.$el.find(".table-model #"+s+".search").val(this.model.get(k));
}
if(key.substr(key.length - 2) === 'id'){
$(".table-model").find('#'+key+' option[value='+data[key]+']').attr('selected', 'selected');
View Collection-inside-Model
var Document = Backbone.Model.extend({
constructor: function() {
this.items = new ItemSet(null, {document: this});
this.items.on('change', this.save, this);
Backbone.Model.apply(this, arguments);
},
parse: function(resp) {
this.items.set(resp.items, {parse: true, remove: false});
delete resp.items;
return resp;
@jrsalunga
jrsalunga / getHoursAMPM
Last active Dec 20, 2015
Javascript Date functions: 1. Get AM/PM Hours 2. Get current day number of current year 3. Get current date. format: yyyy-mm-dd
View getHoursAMPM
/*
1.
*/
Date.prototype.getHoursAMPM = function() {
var date = new Date();
var hours = date.getHours();
hours = hours % 12;
hours = hours ? hours : 12;
return hours;
View webkit-pseudo-elements.md

An ongoing project to catalogue all of these sneaky, hidden, bleeding edge selectors as I prepare my JSConf EU 2012 talk.

Everything is broken up by tag, but within each the selectors aren't particularly ordered.

I have not tested/verified all of these. Have I missed some or got it wrong? Let me know. - A

A friendly reminder that you may need to set this property on your target/selected element to get the styling results you want:

-webkit-appearance:none;

@jrsalunga
jrsalunga / gist:4507054
Created Jan 11, 2013
How To Work With Transparent Colors And Images In CSS Think about a div with a few paragraphs inside. Maybe you want the background of the div to be semi-transparent to allow what’s behind it to show through. Odds are you’d still like the text inside to be fully opaque so it’s easily read. However, because the paragraphs are children of the div,…
View gist:4507054
.element {
position:relative;
z-index:1;
}
.element:before {
content:"";
position:absolute;
z-index:-0;
top:0;
@jrsalunga
jrsalunga / #_no_click
Created Sep 25, 2012
jquery code to prevent hash(#) view in url when clicking <a href='#'>
View #_no_click
$('a[href="#"]').click(function(e){
//$(this).css('border','1px red solid');
e.preventDefault();
})
You can’t perform that action at this time.