Skip to content

Instantly share code, notes, and snippets.

View WebFreak001's full-sized avatar
💾
Saving the world

Jan Jurzitza WebFreak001

💾
Saving the world
View GitHub Profile
!Opacity
Start 0 0
QuadraticOut 0.2 1
Linear 0.7 1
QuadraticIn 0.9 0
!Scale
Start 0 1
Linear 0.8 1
CubicIn 1 2
import * as vscode from 'vscode';
export class FoobarCompletion implements vscode.CompletionItemProvider {
provideCompletionItems(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): Thenable<vscode.CompletionItem[]> {
return new Promise((resolve, reject) => {
let items: vscode.CompletionItem[] = [
new vscode.CompletionItem("apple"),
new vscode.CompletionItem("banana"),
new vscode.CompletionItem("car"),
new vscode.CompletionItem("door"),
{
"name": "a",
"description": "a",
"version": "0.0.1",
"publisher": "WebFreak",
"engines": {
"vscode": "^0.10.1"
},
"categories": [
"Other"
@WebFreak001
WebFreak001 / backup.sh
Created March 16, 2017 12:38
Backup website & mysql database
#!/bin/sh
id=`date +%Y-%m-%d_%H-%M`
# Creates a backup of a website + database in a .tar.gz file
# Archive structure:
# db.sql
# website_folder/
# Name of backup
appname="mywebsite"
@WebFreak001
WebFreak001 / d_to_html.d
Last active October 9, 2017 22:17
Create websites using D, with a cool syntax
module d_to_html;
import std.conv;
import std.stdio;
import std.traits;
import std.range;
struct Element
{
string _name;
@WebFreak001
WebFreak001 / output.d
Last active January 24, 2018 10:53
traits doc generator
[
ConstantCompletion("allMembers", "$(P Takes a single argument, which must evaluate to either
a type or an expression of type.
A tuple of string literals is returned, each of which
is the name of a member of that type combined with all
of the members of the base classes (if the type is a class).
No name is repeated.
Builtin properties are not included.
)
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
@WebFreak001
WebFreak001 / zopflipng_folder.fish
Created June 25, 2019 13:33
Optimizes a whole folder using zopflipng as fish script (just copy paste into the fish shell)
for file in *.png
echo -n "Optimizing $file..."
if zopflipng -y -m $file (basename $file .png)".min.png" | grep "Result is smaller"
mv (basename $file .png)".min.png" $file
echo " optimized."
else
rm (basename $file .png)".min.png"
echo
end
end
@WebFreak001
WebFreak001 / plurals.d
Last active July 20, 2019 14:40
Implements Mozilla's localization and plurals site in D for i18n
/// Implements mozilla's plural forms.
/// See_Also: https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals
/// Returns: the index which plural word to use. For each rule from top to bottom.
int resolvePlural(int form, int n)
{
import std.algorithm : among;
switch (form)
{
// Asian, Persian, Turkic/Altaic, Thai, Lao
module diet2spasm;
import diet.defs;
import diet.dom;
import diet.internal.string;
import diet.input;
import diet.parser;
import diet.traits;
/// Compiles diet code to spasm compatible createElement/textContent/setAttribute D code usable for mixin.