This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$url = "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; | |
$escaped_url = htmlspecialchars( $url, ENT_QUOTES, 'UTF-8' ); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "https://api.short.cm/links"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); | |
curl_setopt($ch, CURLOPT_HEADER, FALSE); | |
curl_setopt($ch, CURLOPT_POST, TRUE); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ | |
\"domain\": \"tuneup.fit\", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST /links/create/yourdoma.in HTTP/1.1 | |
Accept: application/json | |
Accept-Encoding: gzip, deflate | |
Authorization: WRZgCztHImJoqdWO | |
Connection: keep-alive | |
Content-Length: 38 | |
Content-Type: application/json | |
Host: shorturl.localhost | |
User-Agent: HTTPie/0.9.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
To create your own command you need: | |
1. create gist with name "prettydev" | |
2. write JS file in requirejs syntax, which returns object with functions. Like this example | |
To call it you need to write your github login, colon and command name. | |
For example: gugu:javascript 2+3 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <time.h> | |
#include <stdio.h> | |
int main() { | |
setenv("TZ", ":Europe/Berlin", 1); | |
tzset(); | |
struct tm t = {0,21,2,25,9,98,0,0,-1}; | |
struct tm t_min = {0,21,1,25,9,98,0,0,-1}; | |
struct tm t_max = {0,21,4,25,9,98,0,0,-1}; | |
printf("is_dst before: %d\n", t.tm_isdst); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubypython" | |
ENV["DJANGO_SETTINGS_MODULE"] = "settings" | |
ENV["PYTHONPATH"] = "." | |
RubyPython.start(:python_exe => ENV["PYTHON_EXECUTABLE_NAME"]) | |
RubyPython.import('imp').load_source("activate_this",File.join(File.dirname(RubyPython::Runtime.python), "activate_this.py")) | |
$versioning = RubyPython.import("staticutils.versioning") | |
$settings = RubyPython.import("django.conf").settings | |
$storage = RubyPython.import("django.core.files.storage") | |
$fs_storage = $storage.FileSystemStorage(location=$settings.VERSIONED_STATIC_ROOT) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==ClosureCompiler== | |
// @output_file_name default.js | |
// @compilation_level ADVANCED_OPTIMIZATIONS | |
// ==/ClosureCompiler== | |
/** | |
* | |
* Secure Hash Algorithm (SHA1) | |
* http://www.webtoolkit.info/ | |
* |
NewerOlder