Skip to content

Instantly share code, notes, and snippets.

View mrsinguyen's full-sized avatar
🎯
Focusing

Si Nguyen mrsinguyen

🎯
Focusing
View GitHub Profile
@nigelheap
nigelheap / problem_solver.info
Created May 23, 2012 04:50
problem_solver module
name = Problem solver
description = The module that will solve all your drupal problems
package = Problems
version = 1.x
core = 7.x
@webchick
webchick / gist:2802307
Created May 27, 2012 05:47
PSR-0 sux
http://drupal.org/project/abstract - 198 users
http://drupal.org/project/class - 0 users
http://drupal.org/project/clone - 0 users
http://drupal.org/project/do - 4 users
http://drupal.org/project/echo - 853 users
http://drupal.org/project/goto - 0 users
http://drupal.org/project/include - 738 users
http://drupal.org/project/interface - 95 users
http://drupal.org/project/list - 0 users
http://drupal.org/project/or - 0 users
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@rcoh
rcoh / gist:3153394
Created July 20, 2012 21:34
while loop counting
var i,j,k = 0
var x = 0L
while(i < 10000) {
while(j < 1000) {
while(k < 1000) {
x += 1
k += 1
}
k = 0;
j += 1
@crittermike
crittermike / gist:3503791
Last active February 2, 2019 20:11
Import gzipped MySQL DB dump but ignore data from specific tables
# REGULAR VERSION
gunzip -c db.sql.gz | grep -Ev "^INSERT INTO \`(cache_|search_|sessions|whatever)" | mysql -u root -p databasename
# DRUPAL VERSION
gunzip -c db.sql.gz | grep -Ev "^INSERT INTO \`(cache_|search_|sessions|whatever)" | drush sqlc
# Ref: http://drush.ws/examples/example.drushrc.php
# Ref: http://books.tag1consulting.com/scalability/drupal/start/backups
echo 'Including config file…'
if [ -f ./.config ]; then
. ./.config
fi
echo 'Getting database connection settings…'
CMD='foreach ($GLOBALS['"'"'databases'"'"']['"'"'default'"'"'] as $key => $info)';
@dajoho
dajoho / phpcs
Created October 4, 2012 11:39
Install PHPCS OSX
sudo cp /private/etc/php.ini.default /private/etc/php.ini;
sudo php /usr/lib/php/install-pear-nozlib.phar;
pear config-set php_ini /private/etc/php.ini;
pecl config-set php_ini /private/etc/php.ini;
sudo pear upgrade-all;
sudo pear install PHP_CodeSniffer;
----
nano /private/etc/php.ini;
include_path Zeile einkommentieren & umändern in:
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@chx
chx / gist:3930812
Created October 22, 2012 10:27
Batch proof of concept
<?php
use Symfony\Component\HttpFoundation\JsonResponse;
function btest_menu() {
$items['btest'] = array(
'type' => MENU_CALLBACK,
'access callback' => TRUE,
'page callback' => 'btest_page',
);
@preshing
preshing / sort1mb.cpp
Created October 25, 2012 11:28
Sort one million 8-digit numbers in 1MB RAM
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef unsigned int u32;
typedef unsigned long long u64;
//-------------------------------------------------------------------------
// WorkArea
//-------------------------------------------------------------------------