Skip to content

Instantly share code, notes, and snippets.

View rolandinsh's full-sized avatar
🧔
Remote developer (LEMP / LAMP, Python, Flutter, Docker, AI)

Rolands rolandinsh

🧔
Remote developer (LEMP / LAMP, Python, Flutter, Docker, AI)
View GitHub Profile
@rolandinsh
rolandinsh / as-is.md
Last active June 8, 2025 18:38
AS IS License

WARRANTIES OR CONDITIONS

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

@rolandinsh
rolandinsh / string2datestring.js
Last active December 20, 2015 11:19
Converting JavaScript string to Date (and back)
/*
* Converting string to Date
* string2datestring
* var daterstring = '20130731'; // YYYYMMDD
*
* Copyright 2013 Rolands Umbrovskis ( http://umbrovskis.com/ )
* Released under the http://simplemediacode.com/license/
*/
function string2datestring(daterstring,daysadd){
@rolandinsh
rolandinsh / gist:6046670
Created July 20, 2013 22:30
apache2 VirtualHost configuration
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html/
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/example.com/logs/access.log combined
<IfModule mod_expires.c>
ExpiresActive On
@rolandinsh
rolandinsh / gist:5941257
Created July 6, 2013 20:53
update BuddyPress xprofile programmatically
<?php
function smc_update_xprofile($userid,$field,$value) {
// alternative to get user ID
// global $current_user;
// get_currentuserinfo();
// $field = 'Foo'; // xProfile field name
// $value = 'bar'; // desired value
// xprofile_set_field_data($field, $current_user->id, $value);
@rolandinsh
rolandinsh / gist:5939608
Created July 6, 2013 11:15
/1234 and /1234/ to /?p=1234
# /1234 and /1234/ to /?p=1234
^/(\b\d+?\b)(?:/)?$ /?p=$1
@rolandinsh
rolandinsh / github-aptana3.txt
Last active December 19, 2015 07:09
How to set up Git with Aptana Studio 3? http://stackoverflow.com/a/16699825
1: Go to your account on github
and create the repo you want to use. Maybe add a md file.
2: Then in Aptana,
File - Import - Git - Git Repository as New Project,
follow directions on screen for github username &
password and the url for the repo (you can go to your
github account and copy the url
('https://github.com/userName/repoName.git')
3: Do some work in Aptana, add files, folder, etc.
then in Aptana's project browser right click on the project name,
@rolandinsh
rolandinsh / gist:5731792
Last active December 18, 2015 05:19
core8_add_geo_exif add geo exif
<?php
// from core8 class
// publiches as seperate funtion with no optimization.
function core8_add_geo_exif($meta,$file,$sourceImageType) {
$picexif = @exif_read_data( $file );
if (!empty($picexif['GPSLatitude'])){$meta['latitude'] = $picexif['GPSLatitude'] ;}
if (!empty($picexif['GPSLatitudeRef'])){$meta['latitude_ref'] = trim( $picexif['GPSLatitudeRef'] );}
if (!empty($picexif['GPSLongitude'])){$meta['longitude'] = $picexif['GPSLongitude'] ;}
if (!empty($picexif['GPSLongitudeRef'])){$meta['longitude_ref'] = trim( $picexif['GPSLongitudeRef'] );}
@rolandinsh
rolandinsh / gist:5644457
Created May 24, 2013 15:50
Yoast anonymous tracking
<?php
/**
* @package Admin
*/
if ( !defined( 'GAWP_VERSION' ) ) {
header( 'HTTP/1.0 403 Forbidden' );
die;
}
@rolandinsh
rolandinsh / gist:5636349
Last active February 22, 2022 14:56
wp_new_user_notification() - wordpress new user notification message on register
<?php
if ( !function_exists( 'wp_new_user_notification' ) ) {
function wp_new_user_notification( $studentID, $plaintext_pass = '' ) {
$student = new WP_User($studentID);
$student_data = get_userdata( $studentID );
$firstname = $student_data->first_name;
$student_login = stripslashes( $student_data->user_login );
// URLs
$site_url = site_url();
@rolandinsh
rolandinsh / gist:5598867
Created May 17, 2013 12:58
schema.org/Organization logo
<div itemscope itemtype="http://schema.org/Organization">
<a itemprop="url" href="http://simplemediacode.com/">Home</a>
<img itemprop="logo" src="http://i2.me2j.com/smc/smc-300x100-out.png" />
</div>