Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
Rails 3.1 gives us a really easy way to authenticate users in our app: http_basic_authenticate_with
. Using it, all we need to do is create a model for the user (certainly, User model :P) with an attribute called password_digest and some views feature for login and register users. After all, let's relax and let Rails do the hard work.
gem 'bcrypt-ruby', '~> 3.0.0'
First at all, an User model which we can generate by following:
rails g model user email:string password_digest:string
and then add the following methodo call to generated class:
has_secure_password
/* ---------------------------------------------------------- */ | |
/* */ | |
/* A media query that captures: */ | |
/* */ | |
/* - Retina iOS devices */ | |
/* - Retina Macs running Safari */ | |
/* - High DPI Windows PCs running IE 8 and above */ | |
/* - Low DPI Windows PCs running IE, zoomed in */ | |
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */ | |
/* - Android hdpi devices and above */ |
<?php | |
define('CLIENT_ID', 'YOUR_CLIENT_ID'); | |
define('API_KEY', 'YOUR_API_KEY'); | |
define('TOKEN_URI', 'https://connect.stripe.com/oauth/token'); | |
define('AUTHORIZE_URI', 'https://connect.stripe.com/oauth/authorize'); | |
if (isset($_GET['code'])) { // Redirect w/ code | |
$code = $_GET['code']; |
<?php | |
/* | |
Description: A simple class based on a tutorial at WP.Tuts that creates an page with metaboxes. | |
Author: Stephen Harris | |
Author URI: http://www.stephenharris.info | |
*/ | |
/* Copyright 2011 Stephen Harris ([email protected]) | |
This program is free software; you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by |
;(function ($, window) { | |
var intervals = {}; | |
var removeListener = function(selector) { | |
if (intervals[selector]) { | |
window.clearInterval(intervals[selector]); | |
intervals[selector] = null; | |
} |
#!/Library/RubyMotion/bin/ruby -wKUW0 | |
# if your using MacRuby you might change this to | |
# => #!/usr/bin/env macruby -wKUW0 | |
framework 'Foundation' | |
framework 'ScriptingBridge' | |
# the original is part of an arstechnica article by Ryan | |
# SOURCE: http://arstechnica.com/apple/2011/09/tutorial-os-x-automation-with-macruby-and-the-scripting-bridge/ | |
# this script with get your favourite songs and create a Evernote Note # German and English |
(function ($) { | |
/** | |
* @function | |
* @property {object} jQuery plugin which runs handler function once specified element is inserted into the DOM | |
* @param {function} handler A function to execute at the time when the element is inserted | |
* @param {bool} shouldRunHandlerOnce Optional: if true, handler is unbound after its first invocation | |
* @example $(selector).waitUntilExists(function); | |
*/ |
Since I was looking all around how to uninstall packages and after reading tones | |
of documentations here's the short how-to uninstall a workbench package in Laravel | |
(or how I managed it to work out): | |
1. Remove package service provider from 'providers' array in app/config/app.php | |
2. Remove the package folder in workbench/ | |
3. Run: |