Skip to content

Instantly share code, notes, and snippets.

View vrudikov's full-sized avatar

Valentin vrudikov

  • Blackhorse Inc
  • Wastelands
View GitHub Profile
@vrudikov
vrudikov / FacebookConnect.java
Created May 21, 2012 07:24 — forked from sody/FacebookConnect.java
spring-social and tapestry5
package com.example.components;
import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.EventConstants;
import org.apache.tapestry5.Link;
import org.apache.tapestry5.annotations.Cached;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.RequestParameter;
Ext.Date.fuzzy = function(time, local){
(!local) && (local = Date.now());
if (typeof time !== 'number' || typeof local !== 'number') {
return;
}
var
offset = Math.abs((local - time)/1000),
@vrudikov
vrudikov / kind.js
Created March 18, 2013 10:27 — forked from k33g/kind.js
// Just do this : (and include backbone.js)
var Kind = function() {
this.initialize && this.initialize.apply(this, arguments);
};
Kind.extend = Backbone.Model.extend
//Simpler
var Thing = function() {};
Thing.extend = Backbone.Model.extend
<?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>
*/
#!/bin/bash
set -e
if [ ! -z "$1" ]; then
KERNEL="$1"
else
KERNEL="$(uname -r)"
fi
#!/bin/bash
## Mini-Xcode: XCode 5
MIN_VERSION="6.0"
# set default output folder is build
OUTPUT_FOLDER=${PREFIX-build}
# set default compiler
CC=${CC-$(xcrun --find gcc)}
@vrudikov
vrudikov / .htaccess
Created March 12, 2016 10:07 — forked from splittingred/.htaccess
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>
@vrudikov
vrudikov / gist:cbf2f5642886f006225c
Created March 12, 2016 10:08 — forked from splittingred/gist:4689218
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,
@vrudikov
vrudikov / Description
Created March 23, 2016 16:14 — forked from twasink/Description
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.
@vrudikov
vrudikov / how-to-set-up-stress-free-ssl-on-os-x.md
Created April 15, 2016 18:43 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying