This file contains hidden or 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
/*** | |
* Convert standard ISO country codes to NetSuite's world | |
* | |
* @param $isoCode | |
* | |
* @return string|bool | |
*/ | |
public function convertCountryCode($isoCode) | |
{ |
This file contains hidden or 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
# We want to maximise profit selling metal rods: we can cut them to sell more, but performing cuts, has a cost | |
# | |
# If we sell metal rods of length, he receives N x L x metal_price. | |
# The remaining smaller metal rods will be thrown away. | |
# To cut the metal rods, we needs to pay cost_per_cut for every cut. | |
def get_max_profit(cost_per_cut, price, rods): | |
longest_rod = max(rods) | |
max_profit = 0 |
This file contains hidden or 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
def generate_graph(z): | |
""" | |
Generates a dictionary {vertex: set(links)} from the matrix | |
""" | |
graph = {} | |
for key, value in enumerate(range(0, len(z))): | |
z[value] = list(z[value]) | |
graph[value] = set() | |
for k, v in enumerate(z[value]): | |
if int(z[value][k]) == 1: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
/* | |
* jQuery Autolink | |
* jQuery Automail | |
* | |
* @author Riccardo Mastellone | |
* @description Two simple jQuery plugins to detect links (autolink) and email (automail) and make them clickable | |
* @usage $(".contaier").automail().autolink(); | |
*/ | |
jQuery.fn.automail = function() { |
This file contains hidden or 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/bash | |
dblist=`mysql -u root -pYOURPASSWORD -e "show databases" | sed -n '2,$ p'` | |
for db in $dblist; do | |
if [ $db != 'performance_schema' ] && [ $db != 'mysql' ] && [ $db != 'information_schema' ] | |
then | |
mysqldump -u root -pYOURPASSWORD $db > /var/backup/db/$db.sql | |
s3cmd --no-progress --mime-type="application/octet-stream" put /var/backup/db/$db.sql s3://YOURBUCKET/backup-db/$db.sql | |
fi | |
done | |