Skip to content

Instantly share code, notes, and snippets.

View anovsiradj's full-sized avatar

MDMCDC anovsiradj

View GitHub Profile
@hallettj
hallettj / global-variables-are-bad.js
Created February 14, 2009 21:15
How and why to avoid global variables in JavaScript
// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {
<?php
if(isset($_POST['source'])) {
$source = $_POST['source'];
if(isset($_POST['type']) && 'php' == $_POST['type']) {
$code = highlight_string($source, true);
$output = $code;
} else {
$code = htmlentities($source);
@faisalman
faisalman / Rupiah.as
Created February 26, 2011 15:35
Konversi Angka ke format Rupiah & vice versa (C#, PHP, JavaScript, ActionScript 3.0)
package
{
/**
* ActionScript 3.0 Code Snippet
* Convert Number to Rupiah & vice versa
* https://gist.github.com/845309
*
* Copyright 2011-2012, Faisalman
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
@bxt
bxt / php-doc.mkd
Created March 6, 2011 23:59
List of phpdoc-like projects for generating documentation from javadoc-annotated php files

Since there's a lots of phpdoc-like php documentors and the like projects on the webs, and they are all named similar if not equal, I wanted to write a little overview:

phpdoctor of 02/2011

Currently using this, namespace support plus UML stuff.

phpdoctor of 01/2011

Didn't test it, looks good.

@jmettes
jmettes / template-min.xml
Created March 7, 2011 08:15
Minimal/bare-bones Blogger template; used as a starting point.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html>
<head>
<title>
<data:blog.pageTitle/>
</title>
<b:skin><![CDATA[]]></b:skin>
</head>
<body>
@Integralist
Integralist / cancelAJAX.js
Created November 3, 2011 11:17
Try to cancel all jQuery AJAX requests currently running
$.xhrPool = [];
$.xhrPool.abortAll = function() {
/* Original example used _underscore api
_.each(this, function(jqXHR) {
jqXHR.abort();
});
*/
$.each(this, function(jqXHR) {
jqXHR.abort();
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@bmcbride
bmcbride / postgis_geojson.php
Created February 26, 2012 05:43
PHP PostGIS to GeoJSON
<?php
/**
* PostGIS to GeoJSON
* Query a PostGIS table or view and return the results in GeoJSON format, suitable for use in OpenLayers, Leaflet, etc.
*
* @param string $geotable The PostGIS layer name *REQUIRED*
* @param string $geomfield The PostGIS geometry field *REQUIRED*
* @param string $srid The SRID of the returned GeoJSON *OPTIONAL (If omitted, EPSG: 4326 will be used)*
* @param string $fields Fields to be returned *OPTIONAL (If omitted, all fields will be returned)* NOTE- Uppercase field names should be wrapped in double quotes
* @param string $parameters SQL WHERE clause parameters *OPTIONAL*
// Table.js is a small library for manipulating NxN arrays.
// It takes an NxN array and a list of type formatters by column headers so:
// var table = new Table([['one', 'two', 'three'], ["1","jeff larson","3px"]], {
// one : function(it) { return +it; },
// two : function(it) { return it.toUpperCase(); },
// three : function(it) { return +it.replace("px", ''); }
// });
//
var Table = function(data, types){
this.data = data;
@kevinSuttle
kevinSuttle / meta-tags.md
Last active March 31, 2024 14:26 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags