Skip to content

Instantly share code, notes, and snippets.

@marcgg
marcgg / gist:733592
Created December 8, 2010 17:26
Regex to get the Facebook Page ID from a given URL
# Matches patterns such as:
# https://www.facebook.com/my_page_id => my_page_id
# http://www.facebook.com/my_page_id => my_page_id
# http://www.facebook.com/#!/my_page_id => my_page_id
# http://www.facebook.com/pages/Paris-France/Vanity-Url/123456?v=app_555 => 123456
# http://www.facebook.com/pages/Vanity-Url/45678 => 45678
# http://www.facebook.com/#!/page_with_1_number => page_with_1_number
# http://www.facebook.com/bounce_page#!/pages/Vanity-Url/45678 => 45678
# http://www.facebook.com/bounce_page#!/my_page_id?v=app_166292090072334 => my_page_id
# http://www.facebook.com/my.page.is.great => my.page.is.great
@senko
senko / onchange.sh
Last active July 14, 2023 07:54
OnChange - Watch current directory and execute a command if anything in it changes
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
@ismailbaskin
ismailbaskin / turkce_isimler.sql
Last active March 31, 2024 03:45
Türkçe isim veritabanı
-- Turkce isimler sozlugu twitter : http://twitter.com/baskindev
CREATE TABLE `isimler` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`isimler` varchar(255) DEFAULT NULL,
`cinsiyet` varchar(255) DEFAULT NULL COMMENT 'erkek : E , kadın : K , uniseks : U',
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ----------------------------
@jasny
jasny / mysql_splitdump.sh
Last active February 15, 2024 16:13
Split MySQL dump SQL file into one file per table or extract a single table
#!/bin/bash
####
# Split MySQL dump SQL file into one file per table
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump
####
if [ $# -lt 1 ] ; then
echo "USAGE $0 DUMP_FILE [TABLE]"
exit
<form action="https://forms.moon-ray.com/v2.4/form_processor.php?" id="moonray_forms_318" method="post" data-captcha="false">
<input type="hidden" name="uid" value="p2c6505f4" />
<input type="hidden" name="contact_id" id="contact_id_318" value="" />
<input type="hidden" name="redirect" value="http://thankyou.moon-ray.com" />
<input type="hidden" name="tags" value="11;X;" /> <!-- Where X is one of {10=SuperSize, 13=Slim FX, 14=Stimulant X, 15=Ultra Reps} -->
<!-- for the tags, value="11" is sent with the first email submission, and value="15" is sent when the sharing requirements are met -->
<input type="hidden" name="sequence" value="2;" /> <!-- This number will also be dynamic based on which product the choose -->
<input type="hidden" name="owner_" value="1" />
<input type="hidden" id="afft_318" name="afft_" value="" />
<input type="hidden" id="aff_318" name="aff_" value="" />
@mahemoff
mahemoff / names.txt
Created April 5, 2012 22:24
Reserved username list
###
A meta-compilation of:
https://raw.github.com/gist/1453705/d253733a56632a8d2c29321a75c18b627fa4dda8/reserved_usernames.rb
http://blog.postbit.com/reserved-username-list.html
http://www.quora.com/How-do-sites-prevent-vanity-URLs-from-colliding-with-future-features
(Took out some company-specific terms at the top of the first one (e.g. imulus, stacks), added one term so far - 'edits'.)
NOTE: Does not include profanities. You may or may not want to add a list of those.
(See https://www.google.com/search?q=profanity+list, but don't try to apply regexp's here because Scunthorpe - http://en.wikipedia.org/wiki/Scunthorpe_problem)
@melanke
melanke / MultiGetSet.js
Created June 19, 2012 20:53
MultiGetSet.JS - Quickly generate getters and setters for multiple attributes
var MultiGetSet = function(opt){
var getType = function(o) {
return ({}).toString.call(o).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
};
if(!opt.public || !opt.private)
return opt.public;
if(opt.handler && opt.handler.init)
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active March 31, 2024 18:45 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@zhouming
zhouming / MY_Session.php
Created September 8, 2012 05:51
Use redis in Codeigniter Session.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Session extends CI_Session{
private $sess_use_redis = TRUE;
private $redis = '';
public function __construct($params = array()) {
//parent::__construct();
$this->CI =& get_instance();
@Usse
Usse / distance.sql
Created November 16, 2012 10:45
MySQL calculate distance between two latitude/longitude coordinates
CREATE FUNCTION `lat_lng_distance` (lat1 FLOAT, lng1 FLOAT, lat2 FLOAT, lng2 FLOAT)
RETURNS FLOAT
DETERMINISTIC
BEGIN
RETURN 6371 * 2 * ASIN(SQRT(
POWER(SIN((lat1 - abs(lat2)) * pi()/180 / 2),
2) + COS(lat1 * pi()/180 ) * COS(abs(lat2) *
pi()/180) * POWER(SIN((lng1 - lng2) *
pi()/180 / 2), 2) ));
END