Skip to content

Instantly share code, notes, and snippets.

@ivandoric
ivandoric / gist:e4e46294c4d35eac0ec8
Created June 5, 2014 11:17
wordpress: create custom reset password page
<?php //Add all of this tu custom page template ?>
<?php
global $wpdb;
$error = '';
$success = '';
// check if we're in reset form
if( isset( $_POST['action'] ) && 'reset' == $_POST['action'] )
{
@ivandoric
ivandoric / javascriptreact.json
Created September 13, 2020 08:35
Snippet for bootstraping react component, as seen in this video: https://www.youtube.com/watch?v=WSOwvyNArOA
{
"Bootstrap Component": {
"prefix": "comp",
"body": [
"import { Box } from 'reflexbox'",
"import styled from '@emotion/styled'",
"",
"function $1() {",
" return (",
" <$1Styled>",
@ivandoric
ivandoric / gist:11220502
Created April 23, 2014 15:41
wordpress: Default editor styles
/* == WordPress WYSIWYG Editor Styles == */
.entry-content img {
margin: 0 0 1.5em 0;
}
.alignleft, img.alignleft {
margin-right: 1.5em;
display: inline;
float: left;
}
@ivandoric
ivandoric / gist:11215045
Created April 23, 2014 13:24
shell: SCP cheat sheet
Copy the file "foobar.txt" from a remote host to the local host
$ scp your_username@remotehost.edu:foobar.txt /some/local/directory
Copy the file "foobar.txt" from the local host to a remote host
$ scp foobar.txt your_username@remotehost.edu:/some/remote/directory
Copy the directory "foo" from the local host to a remote host's directory "bar"
$ scp -r foo your_username@remotehost.edu:/some/remote/directory/bar
Copy the file "foobar.txt" from remote host "rh1.edu" to remote host "rh2.edu"
@ivandoric
ivandoric / gist:11218980
Created April 23, 2014 15:05
shell: Tar
tar -cvzf backup.tar * //packing
tar zxvf file_name.tar.gz * //unpacking
@ivandoric
ivandoric / gist:11219508
Created April 23, 2014 15:16
wordpress: is_tree function - Check if on certain page or on page children function
<?php
function is_tree($pid) {
global $post;
$anc = get_post_ancestors( $post->ID );
foreach($anc as $ancestor) {
if(is_page() && $ancestor == $pid) {
return true;
}
}
if(is_page()&&(is_page($pid)))
@ivandoric
ivandoric / routes.php
Last active March 1, 2020 10:00
Creating reservation and sending mail example through the routes with JWT in OctoberCMS
Route::middleware(['api', 'jwt.auth'])->group(function () {
Route::post('create-reservation', function(Request $request) {
$reservation = new Reservation;
$reservation->pickup = $request->pickup;
$reservation->dropoff = $request->dropoff;
$reservation->user_id = $request->user_id;
$reservation->vehicle_id = $request->vehicle_id;
$reservation->save();
$user = \RainLab\User\Models\User::where('id', '=', $request->user_id)->first();
@ivandoric
ivandoric / steam.md
Created June 19, 2019 07:21 — forked from graffic/steam.md
Downloading steam games from another computer/faster line

Framing the issue

With almost no bandwith at home, I needed a way to download DOOM that didn't involve blocking the home internet line for two days.

Approach

Using steamcmd you can use any computer to download steam games.

Downloading

  1. Install it
  2. Open it and loging with your username and password: login username password
@ivandoric
ivandoric / momo.js
Created May 6, 2019 09:06
Za momu JSS
/* eslint-disable quote-props */
const style = theme => ({
mainNav: {
marginLeft: '-80px',
'& .menu-wrap': {
position: 'relative',
zIndex: 9
},
'& .logo': {
marginLeft: '20px'
@ivandoric
ivandoric / momoo.jsx
Created May 6, 2019 09:05
Za momu, JSX
import { PureComponent, createRef, cloneElement } from 'react'
import Link from 'next/link'
import injectSheet, { withTheme } from 'react-jss'
import PropTypes from 'prop-types'
import Grid from 'components/Grid'
import LogoFull from 'static/svg/logo-full.svg'
import HamburgerFull from 'static/icons/hamburger-full.svg'
import Close from 'static/icons/close.svg'