Skip to content

Instantly share code, notes, and snippets.

View tobiastom's full-sized avatar

Tobias Tom tobiastom

View GitHub Profile
@tobiastom
tobiastom / lazy.m
Last active August 29, 2015 14:15 — forked from ttepasse/lazy.swift
@class Foo: NSObject {
@property NSString *lala
@property Bool private
- (void)setPrivate(BOOL)private {
private = private
lala = nil
}
- (NSString *)lala {
//
// StringExtension.swift
// Tasty for iOS
//
// Created by Tobias Tom on 06.01.15.
// Copyright (c) 2015 succont e.K. All rights reserved.
//
import Foundation
@tobiastom
tobiastom / gist:5194695
Last active December 15, 2015 03:29 — forked from lmartins/gist:5194675
/*global module:false*/
var path = require('path');
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var folderMount = function folderMount(connect, point) {
return connect.static(path.resolve(point));
};
module.exports = function(grunt) {
#import "AppDelegate.h"
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
dispatch_queue_t the_queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
NSArray *array = [NSArray arrayWithObjects:@"a", @"b", @"c", @"d", @"e", @"f", nil];
@tobiastom
tobiastom / phpvalidate.php
Created September 11, 2012 14:25 — forked from spacemuffin/phpvalidate.php
Coupon validate methods
<?php
namespace redeemFunctions;
class ValidateRedeem {
/*
GetWebContent (Verwendet CURL PHP modul)
- ruft url auf -> JSON Rückgabe (JSON Decoder!)
- 1. Param = URL
- 2. Parm = Referenz fuer Statuscode
# Ruby
File.open("homepages.csv", "w") { |f|
f.write Restaurant.active.delete_if { |r|
r.homepage.empty?
}.map { |r|
[r.id, r.name, r.homepage].join(";")
}.join("\n")
}
# Haskell (untested)
@tobiastom
tobiastom / rsync_backup.py
Created October 18, 2011 10:56 — forked from anonymous/rsync_backup.py
Hardlink backup with rsync
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, os, popen2, time, subprocess
SRC = "/"
HOST = "user@host"
DEST = "/backup_module/%(DATE)s/"
LINK_DEST = "/%(LAST_DATE)s"
EXCLUDE = ["/home/henryk/_secure", "/home/henryk/mnt", "/tmp", "/home/henryk/tmp"]
OPTIONS = ["-HAXax", "--stats", "--delete", "-b"]
<?php
function load( $params ) {
$data = array( 'lulu', array( 'foo' => 'bar' ) );
printf("<script language = 'javascript'>alert(%s);</script>", json_encode( $data ));
}
<?php
$data = array(
'lulu',
array( 'foo' => 'bar' ),
);
?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta charset="utf-8" />
@tobiastom
tobiastom / gist:579108
Created September 14, 2010 14:16 — forked from jeena/gist:579071
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *thisDayComponents = [[NSDateComponents alloc] init];
[thisDayComponents setYear:2010];
[thisDayComponents setMonth:9];
[thisDayComponents setDay:1];
[thisDayComponents setCalendar:gregorian];
NSString *aDate = [[gregorian dateFromComponents:thisDayComponents] descriptionWithLocale:nil];
NSLog(@"day:%i date:%@", [thisDayComponents day], aDate);