Skip to content

Instantly share code, notes, and snippets.

View r007's full-sized avatar

Sergey Monin r007

  • SSU
  • Russia, Saratov
View GitHub Profile
@r007
r007 / gist:1c75566928190656f689
Created February 22, 2015 15:40
Problem with compass (undefined method `start_with?' for nil:NilClass)
error library/stylesheets/themes/aqua-theme.css
undefined method `start_with?' for nil:NilClass
/var/lib/gems/1.9.1/gems/compass-core-1.1.0.alpha.3/lib/compass/core/http_util.rb:17:in `expand_url_path'
/var/lib/gems/1.9.1/gems/compass-core-1.1.0.alpha.3/lib/compass/core/http_util.rb:45:in `compute_relative_path'
/var/lib/gems/1.9.1/gems/compass-core-1.1.0.alpha.3/lib/compass/core/sass_extensions/functions/urls.rb:25:in `stylesheet_url'
/var/lib/gems/1.9.1/gems/sass-3.4.12/lib/sass/script/tree/funcall.rb:139:in `_perform'
/var/lib/gems/1.9.1/gems/sass-3.4.12/lib/sass/script/tree/node.rb:50:in `perform'
/var/lib/gems/1.9.1/gems/sass-3.4.12/lib/sass/tree/visitors/perform.rb:394:in `visit_prop'
/var/lib/gems/1.9.1/gems/sass-3.4.12/lib/sass/tree/visitors/base.rb:36:in `visit'
/var/lib/gems/1.9.1/gems/sass-3.4.12/lib/sass/tree/visitors/perform.rb:158:in `block in visit'
// ==UserScript==
// @name Google Sheets SVG chart copier
// @namespace https://github.com/r007
// @version 0.2
// @description Auto copies SVG code when user clicks on chart
// @author Sergey Monin (https://github.com/r007)
// @match *://docs.google.com/spreadsheets/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js
// @grant GM_setClipboard
// ==/UserScript==
@r007
r007 / facebook-pixel.user.js
Last active November 4, 2015 17:27
Select All Checkboxes on Facebook Pixel Page
// ----------Select all helper for Facebook pixel----------------------------------------------
//
// ==UserScript==
// @name Select All Checkboxes on Facebook Pixel Page
// @namespace r007.github.com/
// @version 0.01
// @description Multi-select a range of checkboxes
// @include http*://business.facebook.com/ads/manager/*
// ==/UserScript==
@r007
r007 / install.sh
Last active April 23, 2019 17:18
Prestashop installation script
#!/bin/bash
clear
echo "INSTALL PRESTASHOP"
echo "=================="
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
@r007
r007 / useProducts.js
Created December 28, 2019 15:52
Fetch products hook
import { useState, useEffect } from 'react';
import { get } from '../utils/rest';
const useProducts = (url, dependencies = []) => {
// Set isLoading to true by default to indicate that data is loading
const [isLoading, setIsLoading] = useState(true);
const [fetchedProducts, setFetchedProducts] = useState([]);
const fetchProducts = (params = {}) =>
get(url, params)
def reward_function(params):
if params["all_wheels_on_track"] and params["steps"] > 0:
reward = ((params["progress"] / params["steps"]) * 100) + (params["speed"]**2)
else:
reward = 0.01
return float(reward)
require('dotenv').config();
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-aws-lambda');
grunt.initConfig({
lambda_invoke: {
default: {
options: {
file_name: 'index.js'
}
@r007
r007 / enhanced_pagination.php
Last active June 7, 2020 19:05
WordPress Enhanced Pagination (Digg-style pagination)
<?php
// Define a namespace
namespace Startuply\Extensions;
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
/**
* Helper class to paginate posts
@r007
r007 / checkout_editor_fields_bug.php
Created November 1, 2020 23:11
Checkout Editor Fields Bug
/**
* Fix form on checkout page (guest post order)
*/
add_action( 'wp_footer', 'soar_repeat_rule_settings', 99 );
function soar_repeat_rule_settings() {
if ( is_checkout() ) {
?>
<script type="text/javascript">
(function($) {