Skip to content

Instantly share code, notes, and snippets.

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
View global-variables-are-bad.js
// 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() {
View blogger-code-sample.php
<?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)
View Rupiah.as
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
View php-doc.mkd

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.
View template-min.xml
<?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
View cancelAJAX.js
$.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 29, 2023 22:48
requestAnimationFrame polyfill
View rAF.js
// 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'];
View table.js
// 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 25, 2023 13:07 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@jonmarkgo
jonmarkgo / call.php
Created March 28, 2012 17:11
Simple Phone Verification with Twilio, PHP, MySQL, and jQuery
View call.php
<?php
require("Services/Twilio.php");
require("database.php");
// require POST request
if ($_SERVER['REQUEST_METHOD'] != "POST") die;
// generate "random" 6-digit verification code
$code = rand(100000, 999999);