Skip to content

Instantly share code, notes, and snippets.

View vrudikov's full-sized avatar

Valentin vrudikov

  • Blackhorse Inc
  • Wastelands
View GitHub Profile
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@splittingred
splittingred / .htaccess
Created April 9, 2012 21:48
Example of how to use new REST server class in MODX 2.3+
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ rest/index.php?_rest=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ rest/index.php [QSA,NC,L]
</IfModule>
@twasink
twasink / Description
Created June 6, 2012 11:55
Spring, Hibernate, HSQLDB and automatically creating tables
An example of using Spring and Hibernate together to automatically create a HSQLDB in-memory database for testing hibernate mappings.
@jcsirot
jcsirot / MockSMTPRule.java
Created August 3, 2012 11:15
SMTP server mock as a JUnit TestRule
package com.chelonix.selenium;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.dumbster.smtp.SimpleSmtpServer;
import com.dumbster.smtp.SmtpMessage;
import com.google.common.collect.Lists;
import org.junit.rules.ExternalResource;
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@asilchev
asilchev / gist:3742724
Created September 18, 2012 11:41
Пример подписывания SOAP
package ru.cti.crypto;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.security.Key;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.Provider;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
anonymous
anonymous / build-bluetooth.sh
Created December 13, 2012 00:20
Scripts and DKMS configuration for building Bluetooth kernel modules.
#!/bin/bash
set -e
if [ ! -z "$1" ]; then
KERNEL="$1"
else
KERNEL="$(uname -r)"
fi
@badsyntax
badsyntax / gist:4330899
Last active November 14, 2022 22:54
Googe places autocomplete implementation using Twitter bootstrap typeahead and google's autocomplete and geocoding services
/**
* Author: Richard Willis - badsyntax.co
* Example here: http://demos.badsyntax.co/places-search-bootstrap/example.html
*
* Please note: This is not a reliable method of geocoding the address. Using the
* PlacesService is a much better approach. View the example above for an example
* of using the PlacesService to geocode the address.
*/
var service = new google.maps.places.AutocompleteService();
@splittingred
splittingred / gist:4689218
Last active April 30, 2019 09:39
Example of modRest, a REST Client, in MODX 2.3.
$config = array(
'baseUrl' => rtrim('http://mywebsite.com/rest/api/','/'),
'format' => 'json', // json or xml, the format to request
'suppressSuffix' => false, // if false, will append .json or .xml to the URI requested
'username' => 'myuser', // if set, will use cURL auth to authenticate user
'password' => 'mypass',
'curlOptions' => array(
'timeout' => 30, // cURL timeout
'otherCurlOption' => 1,
@AgelxNash
AgelxNash / SEOphpthumb.snippet.php
Last active December 12, 2015 01:48
[Evo] ЧПУ имена у картинок. Для удобства картинки раскладываются по папкам как в исходном файле. Затем добавляется папка с месяцем и датой создания картинки. В эту папку вкладывается папка с хешем параметров. И только потом создается сам файл. В имени которого присутствует число, час, минута и секунда создания файла, а так же, оригинальное имя.
<?php
/**
* SEOphpthumb
*
* @category snippet
* @version 1.3
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html
* @author Agel_Nash <Agel_Nash@xaker.ru>
*/