Skip to content

Instantly share code, notes, and snippets.

View iign's full-sized avatar

Ignacio iign

View GitHub Profile
@iign
iign / .htaccess
Created March 10, 2013 02:04
Enable gzip compression on apache server
# BEGIN GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
# END GZIP
@iign
iign / monitor.py
Created October 2, 2013 20:52
Simple site monitor. Gets urls from text file and checks http status code for each.
#!/usr/bin/env
import httplib
file_list = open('sites.txt', 'r')
def check_site(url):
conn = httplib.HTTPConnection(url)
@iign
iign / gist:7283599
Last active December 27, 2015 06:39
Set friendly names for validation attributes in Laravel 4
$rules = array(
'username' => 'required|min:8|unique:users|integer',
'firstname' => 'required',
'lastname' => 'required',
'email' => 'required|email',
'password' => 'required|confirmed'
);
$messages = array(
'required' => 'El campo :attribute es obligatorio.',
@iign
iign / InstaDownload.js
Last active February 8, 2016 14:40
Download photos from Instagram posts
$('body').append('<a download class="instadownload">&#11015; Download</a><style>.instadownload{ position:absolute; border-radius: 3px; font-size: 20px; z-index: 10000; top: 90px; cursor:pointer; right: 20px; padding: 10px; background-color:#FBFDFF; border: 1px solid #125688;}</style>');$
('.instadownload').attr('href', $('meta[property="og:image"]').attr('content'));
Bookmared with: http://mrcoles.com/bookmarklet/
// Paste this
javascript:(function()%7B%24('body').append('%3Ca%20download%20class%3D%22instadownload%22%3E%26%2311015%3B%20Download%3C%2Fa%3E%3Cstyle%3E.instadownload%7B%20position%3Aabsolute%3B%20border-radius%3A%203px%3B%20font-size%3A%2020px%3B%20z-index%3A%2010000%3B%20top%3A%2090px%3B%20cursor%3Apointer%3B%20right%3A%2020px%3B%20padding%3A%2010px%3B%20background-color%3A%23FBFDFF%3B%20border%3A%201px%20solid%20%23125688%3B%7D%3C%2Fstyle%3E')%3B%24('.instadownload').attr('href'%2C%20%24('meta%5Bproperty%3D%22og%3Aimage%22%5D').attr('content'))%7D)()
@iign
iign / demo
Created January 19, 2015 18:20
class DynamicLayoutHandler(object):
def _check_layout(self):
if self.layout is None:
raise FormHelpersException("You need to set a layout in your FormHelper")
def _check_layout_and_form(self):
self._check_layout()
if self.form is None:
raise FormHelpersException("You need to pass a form instance to your FormHelper")
$rules = array(
‘username’ => ‘required|min:8|unique:users|integer’,
‘firstname’ => ‘required’,
‘lastname’ => ‘required’,
‘email’ => ‘required|email’,
‘password’ => ‘required|confirmed’
);
$messages = array(
‘required’ => ‘El campo :attribute es obligatorio.’,
@iign
iign / 3xmixin.less
Created March 17, 2015 15:16
3x support for retina.less mixin
.at2x(@path, @w: auto, @h: auto) {
background-image: url(@path);
@at2x_path: ~`@{path}.replace(/\.\w+$/, function(match) { return "@2x" + match; })`;
@at3x_path: ~`@{path}.replace(/\.\w+$/, function(match) { return "@3x" + match; })`;
@media @highdpi {
background-image: url("@{at2x_path}");
background-size: @w @h;
}
@iign
iign / index.php
Created June 4, 2015 17:38
Silex index.php file
require_once __DIR__ . '/vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$app = new Silex\Application();
// $app['debug'] = true;
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
@iign
iign / gulpfile.js
Last active November 14, 2016 19:11
Basic Gulpfile
var gulp = require('gulp')
var sass = require('gulp-sass')
var autoprefixer = require('gulp-autoprefixer')
var browserSync = require('browser-sync').create()
gulp.task('sass', function () {
gulp.src('sass/**/main.scss')
.pipe(sass({outputStyle: 'uncompressed'}).on('error', sass.logError))
.pipe(autoprefixer('last 3 versions', '> 1%', 'ie 8'))
.pipe(gulp.dest('./css'))
// Sketch Plugin: AEIconizer (ctrl shift i)
// Source: github.com/tadija/AEIconizer
var iTunesSizes = [NSArray arrayWithObjects: 512, nil]
var iOSSizes = [NSArray arrayWithObjects: 83.5, 76, 60, 40, 29, 20, nil]
var watchOSSizes = [NSArray arrayWithObjects: 98, 86, 27.5, 24, nil]
var otherSizes = [NSArray arrayWithObjects: 72, 57, 50, nil]
var iconSizes = [NSArray arrayWithObjects: iTunesSizes, iOSSizes, watchOSSizes, otherSizes, nil]
function onRun(context) {