Skip to content

Instantly share code, notes, and snippets.

View jrsalunga's full-sized avatar
💭
I may be slow to respond.

Jefferson Raga Salunga jrsalunga

💭
I may be slow to respond.
View GitHub Profile
@jrsalunga
jrsalunga / gist:3705639
Created September 12, 2012 09:53
random password generator for mysql
SELECT SUBSTRING(MD5(RAND()) FROM 1 FOR 6) AS password
@jrsalunga
jrsalunga / gist:3705662
Created September 12, 2012 09:56
php random password generator
// string of random a-z, A-Z, 0-9
function generatePassword($length = 8) {
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$count = mb_strlen($chars);
for ($i = 0, $result = ''; $i < $length; $i++) {
$index = rand(0, $count - 1);
$result .= mb_substr($chars, $index, 1);
}
@jrsalunga
jrsalunga / Collection-inside-Model
Created September 23, 2013 01:45
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 December 20, 2015 05:29
Javascript Date functions: 1. Get AM/PM Hours 2. Get current day number of current year 3. Get current date. format: yyyy-mm-dd
/*
1.
*/
Date.prototype.getHoursAMPM = function() {
var date = new Date();
var hours = date.getHours();
hours = hours % 12;
hours = hours ? hours : 12;
return hours;

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 January 11, 2013 00:42
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,…
.element {
position:relative;
z-index:1;
}
.element:before {
content:"";
position:absolute;
z-index:-0;
top:0;
@jrsalunga
jrsalunga / #_no_click
Created September 25, 2012 02:36
jquery code to prevent hash(#) view in url when clicking <a href='#'>
$('a[href="#"]').click(function(e){
//$(this).css('border','1px red solid');
e.preventDefault();
})
@jrsalunga
jrsalunga / hi
Created September 3, 2012 00:17
hello
hello world
@jrsalunga
jrsalunga / App\Http\Controllers\Auth\AuthController.php
Created September 15, 2015 02:16
Laravel 5.1 - Log in with Username or Email
<?php
/**
* This snippet goes into your
* \app\Http\Controllers\Auth\AuthController.php
*
*
*/
/**
* Handle a login request to the application.
*
@jrsalunga
jrsalunga / designer.html
Created November 26, 2014 02:34
designer
<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">