Skip to content

Instantly share code, notes, and snippets.

View ianaya89's full-sized avatar
👾

Nacho Anaya ianaya89

👾
View GitHub Profile
@ianaya89
ianaya89 / .jshintrc
Created December 24, 2014 22:06
JavaScrip code guide lines.
{
"maxerr" : 50, // {int} Maximum error before stopping
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : true, // true: Identifiers must be in camelCase
"curly" : false, // true: Require {} for every new block or scope
"eqeqeq" : true, // true: Require triple equals (===) for comparison
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
"freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
"immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
@ianaya89
ianaya89 / get-pip.py
Created December 29, 2014 04:49
Pipi installation file.
This file has been truncated, but you can view the full file.
#!/usr/bin/env python
#
# Hi There!
# You may be wondering what this giant blob of binary data here is, you might
# even be worried that we're up to something nefarious (good for you for being
# paranoid!). This is a base64 encoding of a zip file, this zip file contains
# an entire copy of pip.
#
# Pip is a thing that installs packages, pip itself is a package that someone
# might want to install, especially if they're looking to run this get-pip.py
@ianaya89
ianaya89 / addJquery.js
Created December 29, 2014 19:45
Add jQuery to any page that does not have it already.
(function() {
if ( !window.jQuery ) {
var $inUse = !!window.$,
script = document.createElement('script');
script.setAttribute('src', '//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js');
script.addEventListener('load', function(){
console.log('jQuery was loaded.');
if ($inUse) {
@ianaya89
ianaya89 / getCookies.js
Created December 29, 2014 19:58
Shows all cookies stored in document.cookies in dev tools.
(function() {
window.getCookies = (function() {
var rawCookies = document.cookie.split(';'),
cookies = [],
parsedCookie = '';
rawCookies.forEach(function(cookie) {
parsedCookie = cookie.split('=');
@ianaya89
ianaya89 / codeEditor.css
Created December 30, 2014 01:02
CSS styles for <pre> and <code> tags.
pre {
border: 1px solid #999;
page-break-inside: avoid;
display: block;
padding: 3px 3px 2px;
margin: 0 0 10px;
font-size: 13px;
line-height: 20px;
word-break: break-all;
word-wrap: break-word;
@ianaya89
ianaya89 / ios.css
Created January 6, 2015 18:59
iOS Media Querys
/*iPhone < 5:*/
@media screen and (device-aspect-ratio: 2/3) {}
/*iPhone 5:*/
@media screen and (device-aspect-ratio: 40/71) {}
/*iPhone 6:*/
@media screen and (device-aspect-ratio: 667/375) {}
/*iPhone 6 Plus:*/
@ianaya89
ianaya89 / Base64Encoder.cs
Created January 20, 2015 20:12
Base64 Encode and Decode Methods
public static string EncodeTo64(string toEncode)
{
byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(toEncode);
string returnValue = System.Convert.ToBase64String(toEncodeAsBytes);
return returnValue;
}
public static string DecodeFrom64(string encodedData)
{
byte[] encodedDataAsBytes = System.Convert.FromBase64String(encodedData);
@ianaya89
ianaya89 / ajax.js
Created January 22, 2015 03:30
Ajax request with Vanilla JS
function ajax(type, url) {
var request = new XMLHttpRequest();
request.open(type, url, true);
request.onload = function() {
if (this.status >= 200 && this.status < 400) {
//succes.
var resp = this.response;
}
else {
@ianaya89
ianaya89 / deepExtend.js
Created January 22, 2015 03:34
Extend an object with Vanilla JS
var extend = function(out) {
out = out || {};
for (var i = 1; i < arguments.length; i++) {
if (!arguments[i])
continue;
for (var key in arguments[i]) {
if (arguments[i].hasOwnProperty(key))
out[key] = arguments[i][key];
@ianaya89
ianaya89 / favicons.html
Last active November 20, 2023 20:47
All Favicons for All Devices and Sizes
<link rel="shortcut icon" sizes="16x16 24x24 32x32 48x48 64x64" href="favicon.ico">
<!-- Mobile (Android, iOS & others) -->
<link rel="apple-touch-icon" sizes="57x57" href="favicon-57.png">
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="favicon-57.png">
<link rel="apple-touch-icon" sizes="72x72" href="favicon-72.png">
<link rel="apple-touch-icon" sizes="114x114" href="favicon-114.png">
<link rel="apple-touch-icon" sizes="120x120" href="favicon-120.png">
<link rel="apple-touch-icon" sizes="144x144" href="favicon-144.png">
<link rel="apple-touch-icon" sizes="152x152" href="favicon-152.png">