Ctrl+KB | toggle side bar |
Ctrl+Shift+P | command prompt |
Ctrl+` | python console |
Ctrl+N | new file |
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
clip < ~/.ssh/id_rsa.pub |
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
drush dl restws | |
drush en restws | |
drush role-add-perm 'anonymous user' 'access resource node' |
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
1. Make sure the ssh public key of your development is added to the live server. This way you won't need a passowrd. Test this by connecting to it directly ssh user@liveserver | |
2. Login to live server by `ssh user@liveserver` and create a new ssh key by `ssh-keygen`. MAKE SURE NOT TO INSERT A PASSWORD. | |
3. Add this public key to your bitbucket or github account that your repository is stored. | |
4. Make sure that the deploy.php script connects to git without https, for example = set('repository', 'git@bitbucket.org:gdrakakis/checkout.git'); | |
5. Run dep deploy production -vvv to see exacty the running comands. | |
CPANEL users | |
--------------- | |
If you can't connect to your live server with ssh, make sure that the user can connect to the server with SSH. | |
To do this go to "Manage Shell Access" of WHM, select the user and assign him "Normal Shell*" |
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 create_load_data_file($arrayofdata,$numcolumns,$pathtofile,$dbtable){ | |
// Create the txt structure | |
$i = 0; | |
foreach($arrayofdata as $column){ | |
$txtcontent .= $column."\t"; | |
++$i; | |
if(($i % $numcolumns) == 0){ $txtcontent .= "\r\n";} | |
} |
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 get_jsfields($input,$begins_with,$numpos,$validation_string){ | |
$jsfields = array(); | |
$getkeys = array_keys($input); | |
for($i=0;$i<sizeof($getkeys);$i++){ | |
if(preg_match("/$begins_with/i", trim($getkeys[$i]))){ | |
$jsfields[$begins_with.$getkeys[$i][$numpos-1]] = ''.$validation_string.''; | |
} | |
} | |
return $jsfields; | |
} |
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 is_date($date){ | |
// date example mm-dd-year -> 09-25-2012 | |
$datechunks = explode("-",$date); | |
if(sizeof($datechunks)==3){ | |
if(is_numeric($datechunks[0]) && is_numeric($datechunks[1]) && is_numeric($datechunks[2])) | |
{ | |
// now check if its a valid date | |
if(checkdate($datechunks[0], $datechunks[1], $datechunks[2])){ | |
return true; | |
}else{ |
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
<?php | |
/* | |
----FEATURES---- | |
1. DOESN'T NEED A DATABASE | |
2. EASY TO SHARE WITH ANYBODY - ITS JUST A CSV FILE SO MANY PEOPLE CAN GIVE YOU QUOTES! | |
3. STRIPS ANY PROBLEMATIC CHARACTER SO YOU CAN PLAY WITH YOUR OWN QUOTE SYMBOLS ( VIA CSS) | |
4. CAN STYLE IT BY CSS |
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 csv2array($file,$head=true,$delim=",",$len=1000) { | |
$return = false; | |
$handle = fopen($file, "r"); | |
if ($head) { | |
$header = fgetcsv($handle, $len, $delim); | |
} | |
while (($data = fgetcsv($handle, $len, $delim)) !== FALSE) { | |
if ($head AND isset($header)) { | |
foreach ($header as $key=>$heading) { | |
$row[$heading]=(isset($data[$key])) ? $data[$key] : ''; |
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
#!/bin/sh | |
# | |
# Add a Google Analytics tag to static website files | |
# @see http://adambuchanan.me/post/26345221717/updating-google-analytics-code-on-many-static-pages | |
# Tested on MacOS 10.8.X | |
# | |
# Usage: | |
# Set the GA parameters below | |
# Execute the script from the top-level of the static site | |
# |