Skip to content

Instantly share code, notes, and snippets.

View xles's full-sized avatar
💭
Github fucking sucks, time to leave this AI garbage site

xles McFuzzypants xles

💭
Github fucking sucks, time to leave this AI garbage site
View GitHub Profile
@xles
xles / resources.sh
Last active September 28, 2017 01:37
Ionic, cloud? pffft…
#! /bin/sh
do_icon() {
PLATFORM=$1
WIDTH=$2
FILENAME=$3
echo 'Generating icon: '${FILENAME}'.png'
magick "resources/icon.png" -resize ${WIDTH}x${WIDTH} \
"resources/"${PLATFORM}"/icon/"${FILENAME}".png"
}
var absolutePaths = function()
{
var i, links = document.body.getElementsByTagName('a');
for (i = 0; i < links.length; i++) {
links[i].href = links[i].protocol + "//" + links[i].host +
links[i].pathname + links[i].search + links[i].hash;
}
}
@xles
xles / toc.js
Created May 18, 2014 16:17
Javascript ToC autogeneration.
(function() {
var article = document.body.getElementsByTagName("article");
if (article.length != 1)
return false;
article = article[0];
var container = document.getElementById("toc");
if (!container) {
container = document.createElement("nav");
<?php
/* What PHP gives us */
public function fubar($bar, $foo = 'banans', $baz = 'bananas')
{
/*
* Function definition code using $foo, $bar and $baz goes here
*/
}
@xles
xles / gist:9209329
Last active August 29, 2015 13:56
the new json api...
posts[0] = json_add_object(NULL,
json_add_string("anchor" , "fancy-post"),
json_add_string("url" , "fancy-post"),
json_add_string("title" , "Fancy Post"),
json_add_string("datetime" ,"2014-01-15"),
json_add_string("date" , "2014-01-15"),
json_add_string("body" , "hoooraaaay, blog post!"),
NULL);
posts[1] = NULL;
@xles
xles / gist:8464894
Created January 16, 2014 22:38
hoedown smartypants
int test_markdown(char *file)
{
hoedown_buffer *ib, *ob;
FILE *in = stdin;
hoedown_renderer *renderer;
hoedown_markdown *markdown;
in = fopen(file, "r");
if (!in) {
@xles
xles / gist:8428210
Created January 14, 2014 23:45
Uncleeeaaan
char tags[128];
char *tmp = tags, *tok = NULL, *foo[123];
int i = 0, noftags = 0;
printf("Tags (separate by commas): ");
fgets(tags, sizeof(tags), stdin);
tok = strtok(&tmp[0], ",");
while (tok) {
trim(tok);
@xles
xles / embed.c
Created January 13, 2014 23:48 — forked from cpq/embed.c
// Copyright (c) Sergey Lyubka, 2013.
// All rights reserved.
// This program is used to embed arbitrary data into a C binary. It takes
// a list of files as an input, and produces a .c data file that contains
// contents of all these files as collection of char arrays.
// Usage:
// 1. Compile this file:
// cc -o embed embed.c
//
@xles
xles / gist:6334967
Created August 25, 2013 16:56
Typefaces used in the radiodoc project.
Title:
Font: Amble
License: Apache License, Version 2.0
Author: Punchcut
URL: http://punchcut.com/ | http://www.fontsquirrel.com/fonts/amble
Body:
Font: Bitter
License: SIL Open Font License, Version 1.1.
Author: Huerta Tipografica
@xles
xles / davis-amd.js
Created August 21, 2013 12:22
AMD wrapped Davis.js https://github.com/olivernn/davis.js/ Will try to make UMD work shortly...
/*!
* Davis - http://davisjs.com - JavaScript Routing - 0.9.9
* Copyright (C) 2011 Oliver Nightingale
* MIT Licensed
*
* Convinience method for instantiating a new Davis app and configuring it to use the passed
* routes and subscriptions.
*
* @param {Function} config A function that will be run with a newly created Davis.App as its context,
* should be used to set up app routes, subscriptions and settings etc.