Skip to content

Instantly share code, notes, and snippets.

View KresimirKoncicNeuralab's full-sized avatar

Krešimir Končić KresimirKoncicNeuralab

View GitHub Profile
// full path to your file
string yourFilePath = HttpContext.Current.Request.PhysicalApplicationPath + "imageFolder\\yourFile.jpg";
// save downloaded file as (name)
string saveFileAs = "yourFile.jpg";
Response.Clear();
Response.AddHeader("content-disposition", "attachment; filename=" + saveFileAs);
Response.WriteFile(yourFilePath);
Response.ContentType = "";
<a href="http://www.facebook.com/sharer.php?u=[URL-TO-SHARE]">Share on Facebook</a>
<a href="http://twitter.com/share?text=[TEXT]&url=[URL-TO-SHARE]">Tweet</a>
<a href="https://plus.google.com/share?url=[URL-TO-SHARE]">Google+ share</a>
DECLARE @Rn int;
DECLARE @RnStart int;
DECLARE @RnEnd int;
DECLARE @Increment int = 5;
DECLARE @PlayerId int = 10;
Select @Rn = tt.RowNo FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY PlayerScore desc) as RowNo from Players) tt WHERE tt.PlayerId = @PlayerId;
add_action( 'admin_menu', 'my_tester_menu' );
function my_tester_menu()
{
add_menu_page( 'Tester Options', 'Tester', 'edit_others_pages', 'tester', 'my_tester_options', null, '4.5' );
add_submenu_page( 'tester', 'Tester sub 1', 'Tester sub 1', 'edit_others_pages', 'testers', 'testCodeFunction1');
add_submenu_page( 'tester', 'Tester sub 2', 'Tester sub 2', 'edit_others_pages', 'testers', 'testCodeFunction2');
}
@KresimirKoncicNeuralab
KresimirKoncicNeuralab / gist:defb82dc838530d6266b
Created August 8, 2014 08:52
Simple HTML JS redirection
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Redirect</title>
<script type="text/javascript"> window.location = "http://www.youwillberedirectedtothisdomain.com" </script>
</head>
<body>
add_filter( 'woocommerce_paypal_supported_currencies', 'add_hrk_paypal_valid_currency' );
function add_hrk_paypal_valid_currency( $currencies )
{
array_push ( $currencies , 'HRK' );
return $currencies;
}
add_filter('woocommerce_paypal_args', 'convert_hrk_to_eur');
function convert_hrk_to_eur($paypal_args)
{
if ( $paypal_args['currency_code'] == 'HRK')
{
$convert_rate = 7.5; //set the converting rate or pull form the DB transients
$paypal_args['currency_code'] = 'EUR'; //change HRK to EUR
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^old-domain.net$ [OR]
RewriteCond %{HTTP_HOST} ^www.old-domain.net$
RewriteRule (.*)$ https://www.new-domain.com$1 [R=301,L]
</IfModule>