Skip to content

Instantly share code, notes, and snippets.

View ivolivares's full-sized avatar
🤙
Probably coding!

Iván Olivares R. ivolivares

🤙
Probably coding!
View GitHub Profile
@ivolivares
ivolivares / longurl.css
Created July 1, 2014 19:04
Long URL Problem and Solution
/* Problem: <a href="">//someurl.com/a-really-really-really-really-really-really-really-really-really-long-url</a> */
a {
word-wrap: break-word;
}
@ivolivares
ivolivares / scroll-iframe.css
Created July 2, 2014 14:55
Scroll iframes -webkit- ready !
.iframe-holder {
-webkit-overflow-scrolling: touch;
overflow-y: scroll;
}
.iframe-holder iframe {
height: 100%;
width: 100%;
}
<!doctype html>
<html>
<head>
<!-- Run in full-screen mode. -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Make the status bar black with white text. -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
# These steps will get nginx installed on your Mac for local development and
# testing purposes, to be used alongside MAMP (which already includes Apache).
# The following steps assume that you're running MAMP and that you already
# have php-cgi in /Applications/MAMP/bin/php/php5.4.10/bin/php-cgi.
# The start-nginx and stop-nginx scripts created at the end do not
# start or stop MySQL because it is assumed that you normally run MAMP
# with Apache + MySQL turned on and that you occasionally want to switch
# your web server to Nginx for testing purposes and that you leave MySQL running.
# This process was tested successfully on OS X 10.9.
@ivolivares
ivolivares / capitalize
Last active August 29, 2015 14:08
Capitalize String on CoffeeScript
String::capitalize = ->
@replace /^./, (match) ->
match.toUpperCase()

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@ivolivares
ivolivares / InstallGearman.md
Last active August 28, 2016 07:05
Install Gearman on OS X

Install Gearman

OSx 10.9.2 Mavericks ++ use brew: brew install -v gearman

If you get an error during the build:

==> make install
#  include <tr1/cinttypes>
           ^
@ivolivares
ivolivares / slug.js
Last active May 10, 2023 07:26 — forked from bentruyman/slug.js
// Generates a URL-friendly "slug" from a provided string.
// For example: "This Is Great!!!" transforms into "this-is-great"
function generateSlug (value) {
// 1) convert to lowercase
// 2) remove dashes and pluses
// 3) replace spaces with dashes
// 4) remove everything but alphanumeric characters and dashes
return value.toLowerCase().replace(/-+/g, '').replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
};