Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| 1. Purchase domain (hover.com) | |
| 2. Heroku app for website | |
| * copy existing site | |
| * Make git repo run | |
| $ git init . | |
| $ git add . | |
| $ git commit -a -m "intial commit" | |
| * $ heroku apps:create DOMAIN (https://devcenter.heroku.com/articles/creating-apps) | |
| * $ git push heroku master | |
| * $ heroku domains:add www.DOMAIN.com |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000Lots of people have asked, so here are a few common tasks you might do in your templates, as they would be written in ExpressionEngine vs. Craft.
| @mixin clearfix-micro() { | |
| & { | |
| *zoom: 1; | |
| } | |
| &:before, | |
| &:after { | |
| content: ""; | |
| display: table; | |
| } | |
| &:after { |
| <?php | |
| # Fill our vars and run on cli | |
| # $ php -f db-connect-test.php | |
| $dbname = 'name'; | |
| $dbuser = 'user'; | |
| $dbpass = 'pass'; | |
| $dbhost = 'host'; | |
| $connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'"); |
| // Bonfire: Find the Longest Word in a String | |
| // Author: @vadimbrodsky | |
| // Challenge: http://www.freecodecamp.com/challenges/bonfire-find-the-longest-word-in-a-string | |
| // Learn to Code at Free Code Camp (www.freecodecamp.com) | |
| function findLongestWord(str) { | |
| return str.toLowerCase().split(' ').sort(function(a, b) { | |
| if (a.length < b.length) { | |
| return 1; | |
| } else if (a.length > b.length) { |
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.
| // 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 |
| #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/ |
| Create a folder in /opt and cd to it | |
| $ sudo mkdir -p /opt/syncthing | |
| $ cd /opt/syncthing | |
| Get the latest arm version of syncthing from github (https://github.com/syncthing/syncthing/releases/) x marks the version number. | |
| $ sudo wget https://github.com/syncthing/syncthing/releases/download/vx.xx.x/syncthing-linux-arm-vx.xx.x.tar.gz | |
| sudo tar -xzvf syncthing-linux-arm-vx.xx.x.tar.gz | |
| sudo rm syncthing-linux-arm-vx.xx.x.tar.gz | |
| Move content one folder up |