Skip to content

Instantly share code, notes, and snippets.

View cawfree's full-sized avatar
😍

cawfree cawfree

😍
View GitHub Profile
@xhh
xhh / .Xdefaults
Created June 20, 2011 14:43
i3 config and Xdefaults samples
! ~/.Xdefaults
! xhh config for terminals e.g. urxvt
! For the latest version, check
! http://github.com/cooky/dotfiles_archlinux/blob/master/.Xdefaults
! normal settings
Xft.dpi: 96
Xft.antialias: true
Xft.rgba: rgb
Xft.hinting: true
@swinton
swinton / MercatorMap.java
Created October 13, 2011 13:22
MercatorMap.java | Utility class to convert between geo-locations and Cartesian screen coordinates, via tillnagel.com
/**
* Utility class to convert between geo-locations and Cartesian screen coordinates.
* Can be used with a bounding box defining the map section.
*
* (c) 2011 Till Nagel, tillnagel.com
*/
public class MercatorMap {
public static final float DEFAULT_TOP_LATITUDE = 80;
public static final float DEFAULT_BOTTOM_LATITUDE = -80;
@nathansmith
nathansmith / html5_template.html
Created December 7, 2011 01:41
Simple HTML5 Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge, chrome=1" />
<title>untitled</title>
<link rel="stylesheet" href="" />
</head>
<body>
@kitek
kitek / gist:1579117
Created January 8, 2012 17:50
NodeJS create md5 hash from string
var data = "do shash'owania";
var crypto = require('crypto');
crypto.createHash('md5').update(data).digest("hex");
@gre
gre / easing.js
Last active June 27, 2024 15:37
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@dskaggs
dskaggs / gist:3788338
Created September 26, 2012 14:21
Using caching to improve your ColdFusion application's performance

As you write more and larger ColdFusion applications, you will start looking for ways to improve the performance of your applications. There are many ways to do this but one of the easiest is to use ColdFusion's caching mechanisms to reduce the amount of work your application has to do over and over. Caching simply refers to the idea that you create a piece of content or data once and hold it in application memory for some period of time. During that time frame, any part of your application that needs that content or data uses the copy that was previously generated rather than regenerating it.

ColdFusion has several different caching mechanisms built in, but they generally fall into two main categories--programmatic caching and application server caching.

##Programmmatic Caching This type of caching is controlled by your application code. You decide which parts of your application would benefit from being cached and use CFML tags and attributes to determine what content is cached and how long your applicati

@a1phanumeric
a1phanumeric / gist:5346170
Created April 9, 2013 14:35
Grep exclusions. Demonstrates how to exclude multiple directories, and files.
grep -r --color --exclude-dir={custom,lib,scripts} --exclude={*.xml,error_log} "beta" .
@katowulf
katowulf / 1_query_timestamp.js
Last active September 21, 2023 20:28
Get only new items from Firebase
// assumes you add a timestamp field to each record (see Firebase.ServerValue.TIMESTAMP)
// pros: fast and done server-side (less bandwidth, faster response), simple
// cons: a few bytes on each record for the timestamp
var ref = new Firebase(...);
ref.orderByChild('timestamp').startAt(Date.now()).on('child_added', function(snapshot) {
console.log('new record', snap.key());
});
@ipedrazas
ipedrazas / gist:be069cdf333ee65eef3a
Created June 4, 2014 10:26
Creating a Self-Signed SSL Certificate
$ openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
...
$ openssl rsa -passin pass:x -in server.pass.key -out server.key
writing RSA key
$ rm server.pass.key
$ openssl req -new -key server.key -out server.csr
...
Country Name (2 letter code) [AU]:UK
State or Province Name (full name) [Some-State]:London
...
@unnikked
unnikked / Brainfuck.java
Last active September 7, 2022 00:20
Tiny Brainfuck Interpreter Written in Java
import java.util.*;
public class Brainfuck {
private Scanner sc = new Scanner(System.in);
private final int LENGTH = 65535;
private byte[] mem = new byte[LENGTH];
private int dataPointer;
public void interpret(String code) {
int l = 0;
for(int i = 0; i < code.length(); i++) {