Skip to content

Instantly share code, notes, and snippets.

View pketh's full-sized avatar
🐢
https://kinopio.club

Pirijan pketh

🐢
https://kinopio.club
View GitHub Profile
@gruber
gruber / Liberal Regex Pattern for All URLs
Last active May 6, 2024 21:38
Liberal, Accurate Regex Pattern for Matching All URLs
The regex patterns in this gist are intended to match any URLs,
including "mailto:foo@example.com", "x-whatever://foo", etc. For a
pattern that attempts only to match web URLs (http, https), see:
https://gist.github.com/gruber/8891611
# Single-line version of pattern:
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))
@benspaulding
benspaulding / Application.applicationWillSwitchOut.applescript
Created October 14, 2011 17:56
AppleScript that will save all documents with unsaved changes when BBEdit loses focus.
(*
File:
Application.applicationWillSwitchOut.scpt
Abstract:
This script will automatically save all on-disk text documents with unsaved
changes when BBEdit loses focus.
Version:
@tcr
tcr / code.js
Created October 26, 2011 06:22
How can you use Mustache with Node.js?
var express = require('express');
var app = module.exports = express.createServer();
// Configuration
app.configure(function(){
app.set('view engine', 'mustache');
app.set('views', __dirname + '/views');
app.register(".mustache", require('stache'));
@frane
frane / ArrayObjectDemo.coffee
Created December 31, 2011 02:19
Traversing arrays and objects in CoffeeScript
# Traversing arrays and objects in CoffeeScript
# The array and object we use for testing
arr = [1, 2, 3, 4, 5]
obj = {a: 1, b: 2, c: 3, d: 4, e: 5}
# 'in' has a different meaning in CoffeeScript than in JavaScript
# CS: element in array -> JS: array.indexOf(element) >= 0
console.log '5 in arr: ' + (5 in arr)
CACHE MANIFEST
#
# Version Control
# v0.0.0 00-00-0000
#
# Handy Dandy Developer Tools
# CHROME chrome://appcache-internals
# FIREFOX about:cache
# Charles - Web Debugging Proxy App
# http://charlesproxy.com
@boucher
boucher / gist:1750368
Created February 6, 2012 07:07 — forked from saikat/gist:1084146
Stripe sample checkout form
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Sample Form</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<script type="text/javascript">
@elijahmanor
elijahmanor / emailPattern.coffee
Created February 8, 2012 05:37
Regular Expressions in CoffeeScript
emailPattern = /// ^ #begin of line
([\w.-]+) #one or more letters, numbers, _ . or -
@ #followed by an @ sign
([\w.-]+) #then one or more letters, numbers, _ . or -
\. #followed by a period
([a-zA-Z.]{2,6}) #followed by 2 to 6 letters or periods
$ ///i #end of line and ignore case
if "john.smith@gmail.com".match emailPattern
console.log "E-mail is valid"
@conorbuck
conorbuck / angle-between-points.js
Created May 5, 2012 22:51
JavaScript: Find the angle between two points
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
};
@bobbydavid
bobbydavid / app.js
Created May 8, 2012 23:46
socket.io in Express 3
var express = require('express')
, http = require('http')
, connect = require('connect')
, io = require('socket.io');
var app = express();
/* NOTE: We'll need to refer to the sessionStore container later. To
* accomplish this, we'll create our own and pass it to Express
* rather than letting it create its own. */
var sessionStore = new connect.session.MemoryStore();
@vasilisvg
vasilisvg / acceptable-retina-images.md
Created July 16, 2012 18:32
Acceptable Retina Images

#Retina images Sharpness is relative. We can only observe if something is really sharp if we can see it next to something that's sharper. Lots of people are looking for solutions for the problem that images look blurry on retina displays. All solutions I've seen so far give the advice to send an image that's twice as wide and twice as high to these new screens. Before you start sending these images, be sure to understand that these files will be four times the size of the smaller version. People with a high end device and a low end connection—everybody in the train in The Netherlands—will hate you.

##Image types I'm generalizing here, but there are two types of images: (1) graphics like logos and (2) photos. Quadroupled images might be justified for the first kind, for logos, icons, things like that. You could also try to find a solution in clever SVG files—with media queries in them, why not? These kinds of ima