Skip to content

Instantly share code, notes, and snippets.

View jorgemudry's full-sized avatar

Jorge Mudry jorgemudry

View GitHub Profile
@davist11
davist11 / Fancy File Inputs.js
Created October 25, 2010 21:32
Fancy File Inputs
var SITE = SITE || {};
SITE.fileInputs = function() {
var $this = $(this),
$val = $this.val(),
valArray = $val.split('\\'),
newVal = valArray[valArray.length-1],
$button = $this.siblings('.button'),
$fakeFile = $this.siblings('.file-holder');
if(newVal !== '') {
@balupton
balupton / README.md
Last active February 10, 2025 05:38
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
@josjac
josjac / BrowserDetect
Created July 19, 2011 19:56
User Agent detected
function BrowserDetect() {
var browser, version, OS, versionSearchString,
body = document.getElementById('body');
function init () {
browser = searchString(dataBrowser) || "";
version = searchVersion(navigator.userAgent) || searchVersion(navigator.appVersion) || "";
OS = searchString(dataOS) || "";
body.className = body.className + ' ' + browser + ' ' + browser + '_' + version + ' ' + OS;
destroy();
@marcoscoelho
marcoscoelho / text_helper.php
Created August 25, 2011 07:22
This function is similar to two native functions from CI (ellipsize and character_limiter) but more ruthless (non-preserves words), flexible (dont alters or strip anything in your string, because you can do it easily if necessary) and accurate (passed in
<?php defined('BASEPATH') OR exit('No direct script access allowed.');
/**
* Character Limiter Mid
*
* Limits the string representing the characters removed from somewhere from
* their mid. This limiter considers the output string as two parts (start and
* end) and not preserves complete words, so you also can chose exactly how many
* characters at start and end you need have.
*
@olivierlacan
olivierlacan / launch_sublime_from_terminal.markdown
Created September 5, 2011 15:50
Launch Sublime Text 2 from the Mac OS X Terminal

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

@jorgemudry
jorgemudry / apple_browser_detect.js
Created March 9, 2012 18:58 — forked from lightyrs/apple_browser_detect.js
How Apple does browser detection
SC._detectBrowser = function(userAgent, language) {
var version, webkitVersion, browser = {};
userAgent = (userAgent || navigator.userAgent).toLowerCase();
language = language || navigator.language || navigator.browserLanguage;
version = browser.version = (userAgent.match(/.*(?:rv|chrome|webkit|opera|ie)[\/: ](.+?)([ \);]|$)/) || [])[1];
webkitVersion = (userAgent.match(/webkit\/(.+?) /) || [])[1];
browser.windows = browser.isWindows = !! /windows/.test(userAgent);
browser.mac = browser.isMac = !! /macintosh/.test(userAgent) || (/mac os x/.test(userAgent) && !/like mac os x/.test(userAgent));
browser.lion = browser.isLion = !! (/mac os x 10_7/.test(userAgent) && !/like mac os x 10_7/.test(userAgent));
browser.iPhone = browser.isiPhone = !! /iphone/.test(userAgent);
var http = require('http'),
util = require('util'),
formidable = require('formidable'),
server;
server = http.createServer(function(req, res) {
if (req.url == '/') {
res.writeHead(200, {'content-type': 'text/html'});
res.end(
"<div align='center'>"+
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active April 1, 2026 10:28
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
Array
(
[0] => 1889883229
[1] => 488835183
[2] => 550593395
[3] => 763493425
[4] => 1932858889
[5] => 2095048392
[6] => 1762303890
[7] => 1408443226
@fideloper
fideloper / install.sh
Last active October 30, 2023 20:03
Vagrant Provisioning Script for PHP applications. This installs a LAMP stack.
#!/usr/bin/env bash
echo ">>> Starting Install Script"
# Update
sudo apt-get update
# Install MySQL without prompt
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'