Skip to content

Instantly share code, notes, and snippets.

View 9kopb's full-sized avatar
💎
xyu.foundation

9kopb 9kopb

💎
xyu.foundation
View GitHub Profile
@alright
alright / gist:1698905
Last active September 30, 2015 01:18
Vkontakte API class
<?php
class Vkapi {
protected static $_client_id = 0;
protected static $_access_token = '%access_token%';
public static function invoke ($name, array $params = array())
{
$params['access_token'] = self::$_access_token;
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@lemieuxster
lemieuxster / Bookmarkified
Created May 2, 2012 18:37
QR Code Bookmarklet
javascript:(function(window, document, undefined) {try {var selectedText = document.getSelection().toString(); if (selectedText === ''){selectedText = window.location.href;} if(selectedText !== ''){var baseQRUrl = 'http://chart.apis.google.com/chart?cht=qr&chs=300x300&chl=' + encodeURIComponent(selectedText); window.open(baseQRUrl, '_blank', 'width=400,height=400');}} catch (e) {}})(window, document);
@dieseltravis
dieseltravis / _.js
Created May 31, 2012 20:53
javascript bookmarklet to edit cookies on a page
(function (w, d) {
var id = (new Date()).valueOf(),
itemTemplate = "<label>"
+ "<code>{name}=</code>"
+ "<input id='Cookie{name}{index}{id}' type='text' value='{value}' style='font-family:monospace;width:50%' />"
+ "</label>"
+ "<input type='button' value='Update' onclick='window.UpdateCookie{id}(\"{name}\", {index});' />"
+ "<input type='button' value='Delete' onclick='window.DeleteCookie{id}(\"{name}\");' />"
+ "<br/>",
formatTemplate = function (name, value, index) {
301 moved permanently (redirect):
<?php
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.example.com');
die();
?>
302 moved temporarily(redirect):
<?php
header('Location: http://www.example.com');
@tskrynnyk
tskrynnyk / MathCaptcha.php
Last active November 9, 2017 09:16
Math Captcha class
<?php
/**
* Math Captcha class.
*
* Generates a simple, plain text math equation as an alternative to image-based CAPTCHAs.
*
* require __DIR__.'/../mathcaptcha.php';
*
* $captcha = new MathCaptcha();
*
<!--somewhere in the headers or in a site-wide JS file or right before you need a retina snippet -->
<script>var SR=SR||{};SR.RETINA=((window.devicePixelRatio !== undefined)&&(window.devicePixelRatio >= 2));</script>
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@chbach
chbach / README.md
Created November 5, 2012 11:37
kirby-captcha

Simple Math Captcha for Kirby

To use this plugin just call captcha() to get the question and check after submitting if the user's input equals $_SESSION['capres'] before sending the mail.

@elmarcoh
elmarcoh / form_fill.js
Created November 24, 2012 01:25
Form fill Bookmarklet with Chilean RUT
//Caution when minifiyng this file: the modulus operator in getRut must have spaces around it, otherwise
//Chrome throws an error, and the damn thing won't work
var auto =
{
names: 'Steve Buscemi Catherine Keener Dermot Mulroney Danielle Zerneck James LeGros Rica Martens Peter Dinklage Kevin Corrigan Hilary Gilford Robert Wightman Tom Jarmusch Michael Griffiths Matthew Grace Ryan Bowker Francesca DiMauro',blurb: 'phpBB is a free, open source Internet community application, with outstanding discussion forums and membership management. Written in the PHP scripting language, and making use of the popular MySQL database, phpBB is a standard among web hosting companies throughout the world, and is one of the most widely-used bulletin board packages in the world. phpBB short-circuits the need for you to be a web development master in order to create and manage massive online communities',password: 'secret',fillerup: function()
{
var all_inputs = document.getElementsByTagName('input');var all_selects = documen