Skip to content

Instantly share code, notes, and snippets.

View luissquall's full-sized avatar

Luis Ramos luissquall

View GitHub Profile
@luissquall
luissquall / main-colors.md
Last active August 28, 2015 18:08
Extract main colors from Google's Material design color palette
  1. Go to Material design Color page: https://www.google.com/design/spec/style/color.html#
  2. Open the JavaScript Console
  3. Execute this script:
var colors=[];$('.color.main-color').each(function(index, el) {colors.push($(el).find('.hex').text())});copy(colors);
  1. The colors are in your clipboard's buffer!
<?php
/**
* dump.php?output=1
*
* Usage: curl http://domain.com/dump.php > dump.sql
*/
$bin = PHP_OS == 'Darwin' ? '/usr/local/mysql/bin/mysqldump' : '/usr/bin/mysqldump';
$user = 'root';
$password = '';
$db = 'cenotes';
@luissquall
luissquall / .htaccess
Last active November 10, 2016 22:56
Redirect HTTP traffic to HTTPS
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]
</IfModule>
@luissquall
luissquall / workshop-environment.sh
Created October 15, 2014 18:46
Workshop environment
mkdir stream-adventure && cd $_
git init
stream-adventure list | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | xargs -I {} sh -c 'mkdir {}; touch {}/program.js'
object {
string apiVersion?;
object {
string kind?;
string lang?;
boolean deleted?;
string selfLink?;
array [
object {}*;
] items?;
input:-moz-placeholder, input::-moz-placeholder, input:-ms-input-placeholder, input::-webkit-input-placeholder {
color: white;
}
<?php
require_once "../../google-api-php-client/src/Google_Client.php";
require_once "../../google-api-php-client/src/contrib/Google_DriveService.php";
require_once "../../google-api-php-client/src/contrib/Google_Oauth2Service.php";
require_once "../basics.php";
require_once "../config.php";
function buildClient($scopes, $sub = false) {
$key = file_get_contents(SERVICE_ACCOUNT_PKCS12_FILE_PATH);
<?php
require_once '../src/Google_Client.php';
function pr($content) {
echo '<pre>';
print_r($content);
echo '</pre>';
}
const CLIENT_ID = 'XXXX';
@luissquall
luissquall / Gruntfile.js
Last active December 16, 2015 08:48
Apply tasks only to changed files.
/*global module:false*/
module.exports = function(grunt) {
// Load tasks
grunt.loadTasks('util/grunt');
// Load vendors tasks
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
@luissquall
luissquall / app.js
Last active December 11, 2015 07:48
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World!');
})
var server = app.listen(3000, function () {
var host = server.address().address
var port = server.address().port