Skip to content

Instantly share code, notes, and snippets.

@FranciscoG
FranciscoG / oocss.css
Last active August 29, 2015 14:02
some helpful css that I keep forgetting and looking up so I'm finally saving it here
/*
sources:
http://www.stubbornella.org/content/2010/06/25/the-media-object-saves-hundreds-of-lines-of-code/
http://jsfiddle.net/necolas/rZvEF/
*/
/* ----- REUSABLE IMG BLOCK ----- */
.imgblock {
// source: https://gist.github.com/adunkman/2580972
// background transparency
background-transparency(hexColor, alpha = 1)
ms-color = argb(hexColor, alpha)
background hexToRgb(hexColor)
background rgba(hexColor, alpha)
.mod-no-rgba &
*zoom 1
background transparent
@FranciscoG
FranciscoG / color.js
Created July 28, 2014 17:41
Stylus extension to support full 6 digit hex colors when needed
/*
* Extend Stylus to allow use of 6 digit hex color
* modified from this StackOverflow answer
* http://stackoverflow.com/a/9378924/395414
*/
module.exports = function() {
var hex = function(n) {
return n.toString(16)
};
@FranciscoG
FranciscoG / server.js
Created August 28, 2014 04:22
simple node server to work on static simple pages
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname,
filename = path.join(process.cwd(), uri);
@FranciscoG
FranciscoG / hhehehe.css
Last active August 29, 2015 14:06
styles for the header in the subreddit r/hhehehe
body{background-color:#96806B;color:black}
#siteTable > div{background-color:white;}
#siteTable{background-color:white;padding:10px;border-radius:10px;border:2px solid rgba(0,0,0,0.5);margin-top:10px;}
#header{background-color:#96806B;margin:10px;}
.side{background-color:white;border: 2px solid rgba(0,0,0,0.5);border-radius:10px;padding:10px;}
#sr-header-area{background-color:#96806B;}
#header-bottom-right{background-color:#96806B;color:black;margin-top:4px;}
#header{border:2px solid rgba(0,0,0,0.5);border-radius:10px;}
#RESShortcutsEditContainer{display:none}
.content{margin:10px;}
/**
* A snippet I created to screen capture full webpages
* relies on html2canvas: http://html2canvas.hertzen.com/
* and also requires local proxy for images embedded from other sites: https://github.com/niklasvh/html2canvas/wiki/Proxies
*
* In this gist I'm using the node.js version of the proxy: https://github.com/BugHerd/html2canvas-proxy-node
*
* Issues:
*
* For longer/larger pages I had an issue where the chrome tab would crash if I used PNG or JPEG, but WEBP seems
@FranciscoG
FranciscoG / csv_upload.php
Last active August 29, 2015 14:07
Just a simple file I created to upload and parse a CSV and insert that data into a MySQL db. mysql_* functions are deprecated, should use mysqli_* instead
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');
class DbClass
{
// MAMP default credentials for testing. These are not actually real creds that mean anything
private $db_url = 'localhost';
private $db_login = 'root';
private $db_pw = 'root';
@FranciscoG
FranciscoG / z-index.styl
Created December 19, 2014 15:58
Simple way to manage z-index with Stylus
/*
This is an easy way (at least for me) to manage z-index using Stylus.
Using 'hashes' : http://learnboost.github.io/stylus/docs/hashes.html
*/
// Step 1 - Setup a hash in your variables
// I like to name my keys the exact same thing as the element class/id
// from, here I can see the order of my z-indexes and I can move them around easily
zarray = {
@FranciscoG
FranciscoG / template.bat
Last active August 29, 2015 14:14
A Batch / Shell template - not finished or tested yet
: inspired by - http://github.com/rmitton/incbin
:
: Usage:
: Windows: template.bat
: UNIX: sh template.bat
:
: ; if false ; then
<!--- : Begin batch script --->
@FranciscoG
FranciscoG / fiddle-log.js
Last active August 29, 2015 14:15
little snippet to help me test code inside jsFiddles, Codepens, etc. When code is just slightly too big for Console.log
/*
<button id="run">run</button>
<button id="clear">clear</button>
<div id="log"></div>
*/
function run() {
try {
// put all code here