Skip to content

Instantly share code, notes, and snippets.

View jorgepedret's full-sized avatar
😀
Turned on by Open Source

Jorge Pedret jorgepedret

😀
Turned on by Open Source
View GitHub Profile
@jorgepedret
jorgepedret / places.md
Last active August 29, 2015 14:21
Places for dreaming meetup
@jorgepedret
jorgepedret / fakeagent.sh
Created March 27, 2015 01:55
A bash script that uses curl to generate hits on a url from different user agents
#!/bin/bash
ag[1]="Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0"
ag[2]="Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
ag[3]="Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko"
ag[4]="Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.2.13) Gecko/20101203 iPhone"
ag[5]="Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3_3 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
ag[6]="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20120101 Firefox/29.0"
ag[7]="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:21.0) Gecko/20130331 Firefox/21.0"
ag[8]="Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/536.5 (KHTML like Gecko) Chrome/19.0.1084.56 Safari/1EA69"
@jorgepedret
jorgepedret / wishlist.md
Last active August 29, 2015 13:58
Atom wishlist
  • Save the state of the windows, projects and even un-saved files
  • Open faster
  • Type faster, there's an odd delay everytime you time that doesn't feel completely real time
  • Close HTML tags automatically
  • Allow me to change the syntax from the keyboard (in sublime: cmd-shift-P > 'javascript' > Enter)
  • Soft line breaks should continue indented where the element
  • Get rid of that uggle "waiting" alert when trying to close or reload the editor
  • Do not trim white space by default
@jorgepedret
jorgepedret / redis.sh
Created February 18, 2014 19:32
Installing/Updating redis
wget http://download.redis.io/releases/redis-2.8.6.tar.gz
tar xzf redis-2.8.6.tar.gz
cd redis-2.8.6
make
make install
@jorgepedret
jorgepedret / _data.json
Created December 10, 2013 19:52
Using Harp as a library
{
"index": {
"title": "Hello World"
}
}
@jorgepedret
jorgepedret / dabblet.css
Created December 2, 2013 19:22 — forked from LeaVerou/dabblet.css
(C)Leanest CSS spinner ever
/**
* (C)Leanest CSS spinner ever
*/
@keyframes spin {
to { transform: rotate(1turn); }
}
.progress {
position: relative;
@jorgepedret
jorgepedret / sitemap.xml.jade
Created October 25, 2013 19:02
Recursive function to create dynamic sitemap of your website in Harp using Jade
- var paths = [], files = []; function recursiveTree(obj) { if (typeof obj == "object" && !obj.length) { for (item in obj) { if (item === "contents") { recursiveTree(obj[item]); } else if (item != "data") { paths.push(item); recursiveTree(obj[item]); paths.splice(paths.length-1, 1); } } } else if (typeof obj == "object") { for (i in obj) { var file = obj[i]; if (/(\.html$)/.test(file)) { paths.push(file); files.push("/" + paths.join("/")); paths.splice(paths.length-1, 1); } } } }; recursiveTree(public);
xml
urlset(xmlns="http://www.sitemaps.org/schemas/sitemap/0.9")
- for(i in files) {
url
loc= files[i]
priority 0.5
- }
@jorgepedret
jorgepedret / init.js
Created October 18, 2013 18:24
Snippet to extend Backbone's view to avoid the empty wrapping element when rendering
/*
* Helper method to avoid Backbone wrapping empty element
*/
Backbone.View.prototype.replaceElement = function (html) {
if (typeof html === "string") {
html = $(html);
}
this.$el.replaceWith(html);
$(this.el).undelegate();
this.setElement(html);
@jorgepedret
jorgepedret / gist:7034273
Created October 17, 2013 23:44
testing if current.source matches certain strings
/^\/(gallery|catalog|about)/.test(current.source)
@jorgepedret
jorgepedret / blog.jade
Created October 9, 2013 17:07 — forked from dyoder/blog.jade
Harp blog excerpt example
- function excerpt(markup) {
- return markup.split("<!-- more -->")[0]
- }
.blog.summary
ul
each post, slug in public.posts.data
li
h3 #{post.title}
p.byline