This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var g = G$('John', 'Snow'); | |
// console.log(g); | |
// g.greet().setLang('es').greet(true).log(); | |
$('#login').click(function () { | |
var lang = $('#lang').val(); | |
g.setLang(lang).HTMLGreeting('#greeting', true).log(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function curry(func) { | |
var slice = Array.prototype.slice, | |
args = slice.call(arguments, 1); | |
return function () { | |
return func.apply( | |
null, | |
args.concat(slice.call(arguments, 0)) | |
); | |
}; | |
} |
https://github.com/rg3/youtube-dl#format-selection-examples
youtube-dl --yes-playlist -f 'best[ext=mp4]' https://www.youtube.com/playlist\?list\=XXX
- Name variables and classes using short phrases.
- Variable names have all letters lowercase separated by underscores (snakecase):
this_is_an_example
- Classes and modules capitalize each word in the phrase (mixed case):
ThisIsAnExample
- Database table names and variable names use snake case.
- Table names are always plural:
orders
,thid_parties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# update | |
sudo apt-get update | |
# install apache | |
sudo apt-get install -y apache2 | |
# install mysql and php-mysql | |
sudo apt-get install mysql-server php5-mysql | |
# install mysql and init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
// Some algorithms have been ported from Apache OpenOffice: | |
/************************************************************** | |
* | |
* Licensed to the Apache Software Foundation (ASF) under one | |
* or more contributor license agreements. See the NOTICE file | |
* distributed with this work for additional information | |
* regarding copyright ownership. The ASF licenses this file |
Source -- http://craftcms.stackexchange.com/a/6996
Untested, but you should be able to do this by using the [merge filter in Twig][1] to join the two results together.
Get the top level 'landing page' for this section:
{% set landingPage = entry.getAncestors().level(1) %}
By default, Rails applications build URLs based on the primary key -- the id
column from the database. Imagine we have a Person
model and associated controller. We have a person record for Bob Martin
that has id
number 6
. The URL for his show page would be:
/people/6
But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6
here, is called the "slug". Let's look at a few ways to implement better slugs.