Skip to content

Instantly share code, notes, and snippets.

View and1truong's full-sized avatar
🎯

Hong Truong and1truong

🎯
View GitHub Profile
@and1truong
and1truong / gist:2250220
Created March 30, 2012 09:14
cck/modules/content_migrate/modules/content_migrate.filefield.inc
<?php
/**
* Implements hook_content_migrate_data_record_alter().
*
* Tweaks individual records in a field.
*/
function content_migrate_filefield_data_record_alter(&$record, $field, $instance) {
switch($field['type']) {
INSERT INTO `content_field_fightsoc_video_2` (`vid`, `nid`, `field_fightsoc_video_2_embed`, `field_fightsoc_video_2_value`, `field_fightsoc_video_2_provider`, `field_fightsoc_video_2_data`, `field_fightsoc_video_2_version`, `field_fightsoc_video_2_duration`) VALUES
(1478, 1478, 'http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=104453377#pm_cmp=vid_OEV_P_P', '104453377#pm_cmp=vid_OEV_P_P', 'myspace', 'a:7:{s:16:\"_emfield_arghash\";s:37:\"Myspace::104453377#pm_cmp=vid_OEV_P_P\";s:3:\"2.0\";a:1:{s:7:\"CHANNEL\";a:1:{s:5:\"TITLE\";a:2:{i:0;s:7:\"MySpace\";i:1;N;}}}s:7:\"CHANNEL\";a:11:{s:11:\"DESCRIPTION\";a:2:{i:0;s:7:\"MySpace\";i:1;N;}s:4:\"LINK\";a:2:{i:0;s:28:\"http://myspace.com/492846383\";i:1;N;}s:13:\"LASTBUILDDATE\";a:2:{i:0;s:29:\"Tue, 07 Sep 2010 22:09:24 GMT\";i:1;N;}s:4:\"DOCS\";a:2:{i:0;s:18:\"http://myspace.com\";i:1;N;}s:9:\"GENERATOR\";a:2:{i:0;s:15:\"CHA1mwebnet1269\";i:1;N;}s:16:\"MYSPACE:FRIENDID\";a:2:{i:0;s:9:\"492846383\";i:1;N;}s:14:\"MYSPACE:USERID\";a:2:{i:0;s:2:\"-
@and1truong
and1truong / d6.make
Created April 16, 2012 03:51
Try Drupal 6 branch
api = 2
core = 6.x
; CORE
; -----------
projects[drupal][type] = core
; Translations
translations[] = es
translations[] = he

Setup a gateway server

  1. setup iptables sudo iptables -A FORWARD -o eth0 -i eth1 -s 192.168.1.0/24 -m conntrack --ctstate NEW -j ACCEPT sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT sudo iptables -A POSTROUTING -t nat -j MASQUERADE
  2. save iptables and restore on startup sudo iptables-save > /etc/iptables.sav sudo echo "iptables-restore < /etc/iptables.sav" >> /etc/rc.local
  3. Enable ip forwarding
<?php
$view = new view;
$view->name = 'question_answer_listing';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Question Answer Listing';
$view->core = 7;
$view->api_version = '3.0';
@and1truong
and1truong / base.make
Created July 21, 2012 07:52
Drupal Make Files
; ======================================
; Kai Curry Base Drush Make
;
; Requires boa.make
;
; $ drush make base.make base701
; ======================================
api = 2
core = 7.x
@and1truong
and1truong / fix.php
Created July 23, 2012 10:05
Fix OG label - #drupal #og
<?php
/**
* Implements hook_entity_load().
*
* @param type $entities
* @param type $type
* @return type
*/
function HOOK_entity_load($entities, $type) {
@and1truong
and1truong / README.md
Created July 26, 2012 03:51 — forked from mbostock/.block
Epicyclic Gearing

From Wikipedia: Epicyclic gearing or planetary gearing is a gear system consisting of one or more outer gears, or planet gears, revolving about a central, or sun gear. … Epicyclic gearing systems also incorporate the use of an outer ring gear or annulus, which meshes with the planet gears.

Built with D3.js.

@and1truong
and1truong / fix.php
Created July 26, 2012 20:30
Make all Ubercart products shippable
<?php
/**
* Implements hook_cart_item().
*
* Make sure all products are shippable.
* Fix Card #6: Shipping issue with multiple products.
*/
function ss_cart_item($op, &$item) {
switch ($op) {

He he

I have a free and super fast blog ;)

Andy@VC