Skip to content

Instantly share code, notes, and snippets.

@gorobey
gorobey / gist:67a5d239ea069e15763e
Created March 7, 2016 10:49 — forked from joshhartman/gist:2271523
Yahoo! Weather API Example Using SimpleXML in PHP
<?php
if(isset($_POST['zipcode']) && is_numeric($_POST['zipcode'])){
$zipcode = $_POST['zipcode'];
}else{
$zipcode = '50644';
}
$result = file_get_contents('http://weather.yahooapis.com/forecastrss?p=' . $zipcode . '&u=f');
$xml = simplexml_load_string($result);
//echo htmlspecialchars($result, ENT_QUOTES, 'UTF-8');
@gorobey
gorobey / lastpass_to_keepassx.rb
Created April 14, 2016 07:44 — forked from jmazzi/lastpass_to_keepassx.rb
Convert LastPass CSV to KeePassX XML
#!/usr/bin/ruby
#
# I recommend using Pocket to do the export. It works better than the browser extensions.
require 'rubygems'
require 'htmlentities'
require 'csv'
# CHANGE THIS
input_file = '/path/to/passwords.csv'
@gorobey
gorobey / force-http.tpl
Created July 4, 2016 10:09 — forked from wodCZ/force-http.tpl
vestacp cert letsencrypt
server {
listen %ip%:%web_port%;
server_name %domain_idn% %alias_idn%;
location / {
rewrite ^(.*) https://%domain_idn%$1 permanent;
}
}
@gorobey
gorobey / bootstrap-col-inset.css
Last active July 15, 2017 18:51 — forked from nathanpitman/gist:4038248
Responsive 'insets' / 'negative offsets' for Twitter Bootstrap
.col-xs-inset-12 {
margin-left: -100%;
}
.col-xs-inset-11 {
margin-left: -91.66666667%;
}
.col-xs-inset-10 {
margin-left: -83.33333333%;
}
.col-xs-inset-9 {
@gorobey
gorobey / wordpress-change-domain-migration.sql
Created April 1, 2017 19:04 — forked from chuckreynolds/wordpress-change-domain-migration.sql
Use this SQL script when changing domains on a WordPress site. Whether you’re moving from an old domain to a new domain or you’re changing from a development domain to a production domain this will work. __STEP1: always backup your database. __STEP2: change the ‘oldsite.com’ and ‘newsite.com’ variables to your own. __STEP3: make sure your databa…
SET @oldsite='http://oldsite.com';
SET @newsite='http://newsite.com';
UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, @oldsite, @newsite);
UPDATE wp_links SET link_url = replace(link_url, @oldsite, @newsite);
UPDATE wp_postmeta SET meta_value = replace(meta_value, @oldsite, @newsite);
/* only uncomment next line if you want all your current posts to post to RSS again as new */
#UPDATE wp_posts SET guid = replace(guid, @oldsite, @newsite);
@gorobey
gorobey / dump.sh
Created April 4, 2017 12:56 — forked from andsens/dump.sh
Backup all MySQL databases into separate files
#!/bin/sh
## backup each mysql db into a different file, rather than one big file
## as with --all-databases. This will make restores easier.
## To backup a single database simply add the db name as a parameter (or multiple dbs)
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is
## Create the user and directories
# mkdir -p /var/backups/mysql/databases
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup
## Remember to make the script executable, and unreadable by others
@gorobey
gorobey / countries.sql
Created June 2, 2017 13:02 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@gorobey
gorobey / responsive-align.less
Created June 15, 2017 08:43 — forked from ohryan/responsive-align.less
Bootstrap 3 Responsive Text Align
.text-xs-left { text-align: left; }
.text-xs-right { text-align: right; }
.text-xs-center { text-align: center; }
.text-xs-justify { text-align: justify; }
@media (min-width: @screen-sm-min) {
.text-sm-left { text-align: left; }
.text-sm-right { text-align: right; }
.text-sm-center { text-align: center; }
.text-sm-justify { text-align: justify; }
@gorobey
gorobey / custom-action-url.php
Created July 5, 2017 08:45 — forked from jayllellis/custom-action-url.php
Custom Contact Form 7 action URL
<?php
// Place this in your functions.php file
add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');
function wpcf7_custom_form_action_url(){
return 'send.php';// replace this with the new action url (excluding the 'http://')
}
?>
@gorobey
gorobey / JSONP_Example.php
Created July 15, 2017 20:55 — forked from therealklanni/JSONP_Example.php
Simple public Web API in PHP using JSONP
<?php
/* JSONP_Example.php
* Author: Kevin Lanni
* Description: Demonstrates how to create a simple public Web API using JSONP responses
* This is useful for opening Web APIs for public use without the need for proxying or other SOP work-arounds.
* This example does not demonstrate API keys or any other method of authentication.
*/
// Supply a header to set the proper expectation for the client browser
header('Content-Type: application/json');