Skip to content

Instantly share code, notes, and snippets.

tecywiz121

Block or report user

Report or block tecywiz121

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View example.rs
#[derive(Deserialize)]
struct Demo {
d1: Demo<i32>,
d2: Demo<String>,
d3: Demo<String>,
}
enum DemoEnum<T> {
A,
B,
@tecywiz121
tecywiz121 / commands.vim
Created Oct 26, 2017
Sequence of commands demonstrating loss of nomodifiable
View commands.vim
let my_buf=bufnr('banana', 1)
call nvim_buf_set_lines(my_buf, 0, 0, v:true, ['this is a line'])
call nvim_buf_set_option(my_buf, 'modifiable', v:false)
execute ":buffer " . my_buf
execute "normal! oTyped after modifiable=False\<esc>"
View Metadata.java
import java.io.File;
import java.util.Iterator;
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.metadata.IIOMetadata;
import javax.imageio.stream.ImageInputStream;
import org.w3c.dom.NamedNodeMap;
@tecywiz121
tecywiz121 / GlobBuilder.java
Created Aug 9, 2013
Java class that implements a state machine for converting glob-like patterns into regular expressions
View GlobBuilder.java
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.File;
public final class GlobBuilder {
private static final String PATTERN_STAR;
private static final String PATTERN_STAR_STAR = ".*";
private static final String PATTERN_QUESTION = ".";
@tecywiz121
tecywiz121 / mitigate-xss.js
Created Aug 24, 2012
Mitigate XSS client side
View mitigate-xss.js
/*
* A proof of concept client-side XSS mitigation library with minimal server side requirements.
*
* Installation:
*
* Insert this script immediately following the opening tag of the body element.
*
* Strip every instance of </noscript> and </iframe> before the output leaves
* your server.
*/
@tecywiz121
tecywiz121 / gist:782081
Created Jan 16, 2011
Versioned Database
View gist:782081
-- Base class for all versioned models
CREATE TABLE `VersionedModel` (
`BlobId` INTEGER(11) NOT NULL,
`VersionId` BINARY(64) NOT NULL,
`IsTip` BOOLEAN NOT NULL,
PRIMARY KEY (`BlobId`,`VersionId`),
KEY `model_tip_index` (`BlobId`,`IsTip`)
) ENGINE=InnoDB;
-- Tracks changes to models
You can’t perform that action at this time.