Skip to content

Instantly share code, notes, and snippets.

View thomasfr's full-sized avatar

Thomas Fritz thomasfr

View GitHub Profile
@thomasfr
thomasfr / nginx.conf
Created March 22, 2014 22:34
Redirect all requests not matching server_name to `www.example.com`
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
rewrite ^ http://www.example.com permanent;
}
server {
server_name www.example.com
root /usr/share/nginx/html;
index index.html;
@thomasfr
thomasfr / Office_Hours_Variant_1.adoc
Last active August 29, 2015 13:57
A Neo4J GraphGist about an attempt to model Office Hours. I want to be abel to ask questions like: "What location has opened now or at a given date and time?" and "Has this location open now or at a given date and time?"
CREATE (locationA:Location{name:"location A"}),
(locationA)-[:hasOfficeHours]->(officeHours:OfficeHours),
(officeHours)-[:year]->(year:Year{value:2014}),
(year)-[:month]->(month:Month{value:3,name:"March"}),

(month)-[:day]->(day24:Day{value:24, name:"Monday"}),
(day24)-[:hasInterval]->(:Interval{from:8,to:12}),
@thomasfr
thomasfr / Office_Hours_Variant_2.adoc
Last active August 29, 2015 13:57
A Neo4J GraphGist about an attempt to model Office Hours. I want to be abel to ask questions like: "What location has opened now or at a given date and time?" and "Has this location open now or at a given date and time?"
@thomasfr
thomasfr / Opening_Hours_Variant_3.adoc
Last active August 29, 2015 13:57
A Neo4J GraphGist about an attempt to model Office Hours. I want to be abel to ask questions like: "What location has opened now or at a given date and time?" and "Has this location open now or at a given date and time?"
@thomasfr
thomasfr / Example-POST-orders.md
Last active August 29, 2015 14:03
Eversport API

Example POST Request

Full Request / Response Format and documentation can be read here: http://jsonapi.org/format/

POST https://api.eversport.at/v2/venues/1234/orders
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "links": {
var MagentoAPI = require('magento');
var util = require('util');
var magento = new MagentoAPI({
host: 'wunderl.sernji.com',
port: 80,
path: '/api/xmlrpc/',
login: 'user',
pass: 'password'
});
@thomasfr
thomasfr / newUserAndDatabase.sql
Last active August 29, 2015 14:06
Create Mysql user, password and grant rights on database
/** GRANT [type of permission] ON [database name].[table name] TO ‘[username]’@'localhost’ IDENTIFIED BY 'some_pass' WITH GRANT OPTION; **/
GRANT ALL PRIVILEGES ON DATABASE.* TO 'newuser'@'localhost' IDENTIFIED BY 'some_pass';
FLUSH PRIVILEGES;
/** BACKUP USER **/
GRANT SELECT,LOCK TABLES ON *.* TO 'backup'@'localhost' IDENTIFIED BY 'PASS';
#!/bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
var foo = function(text, callback) {
if(text == "hello") {
callback("hello world");
console.log("Someone said hello");
}
callback("why don't you say hello?");
console.log("nobody likes me :(");
}
foo("hello", function(result) {
options: {
patterns: [
{
src: ['assets/js/**/*.js', 'assets/css/**/*.css',],
search: /@@([^@]+?)@@/g,
replace: function(matched, part, offset, string) {
if(summary[part]) {
return summary[part];
}
else {