Skip to content

Instantly share code, notes, and snippets.

@bleeDev
bleeDev / gist:bd91f9c2290722345d00d11cc5722d81
Last active April 4, 2018 04:52
Outrigger Drupal PHPCBF
rig project run grunt validate
rig project run cli "php ./vendor/bin/phpcbf --standard=./vendor/drupal/coder/coder_sniffer/Drupal src/modules/"
git clone --mirror [source git URL]
cd repo
git push --mirror [mirror git URL]
@bleeDev
bleeDev / index.html
Last active October 31, 2017 15:38
jaPbeN
<html>
<body>
<div id="app">
<div>
{{ notes }}
</div>
<button @click='increase'>Increase</button>
<button @click='decrease'>Decrease</button>
</div>
@bleeDev
bleeDev / The universe
Last active June 25, 2016 05:09
Space Libre
Planetary Aliance
Interglatic Agency
Ship registry - DCC (Defense Construction Contract)
Interglatic Space Ship
Vulcans (Majellians) - Logic Antenae black blood (silver)
Romulans (DeKelles (keels) - Viacomunist Government)
Klingons (Koenigoids) - Tusked wookies
Halcyon (Bird of prey)
Andorians (Rodderians) - Green skins w/ Pointy ears
@bleeDev
bleeDev / private-github-release-download.sh
Created April 29, 2016 19:00 — forked from illepic/private-github-release-download.sh
Download the latest release binary from a private GitHub repo. (i.e. a .tar.gz that you have manually uploaded in a GitHub release). Update OAUTH_TOKEN, OWNER, REPO, FILE_NAME with your custom values.
#!/usr/bin/env bash
# Authorize to GitHub to get the latest release tar.gz
# Requires: oauth token, https://help.github.com/articles/creating-an-access-token-for-command-line-use/
# Requires: jq package to parse json
# Your oauth token goes here, see link above
OAUTH_TOKEN="34k234lk234lk2j3lk4j2l3k4j2kj3lk"
# Repo owner (user id)
OWNER="your-user-name"
{
"type": "news_entry",
"action": "save",
"entry": {
"article_type": "post",
"ads_enabled": 1,
"comments_enabled": 0,
"search_enabled": 1,
"publication_date": "1410147525",
"breaking_news": 0,
@bleeDev
bleeDev / gist:7815410
Created December 5, 2013 22:46
prepareRow example
<?
$link = $row->lnk;
if (strpos($link, 'www.facinghistory.org/') !== FALSE) {
$row->lnk = str_replace('www.facinghistory.org/', '', $row->lnk);
}
if (strpos($link, 'www.facing.org/') !== FALSE) {
$row->lnk = str_replace('www.facing.org/', '', $row->lnk);
}
@bleeDev
bleeDev / gist:7775965
Last active December 30, 2015 04:29
Change Address Field from Address 1/2 Text fields to Textarea
-- Thanks to David (@nadavoid) for working this out.
- [custom_module].module
<?php
/**
* Implements hook_ctools_plugin_directory().
*/
function [custom_module]_ctools_plugin_directory($module, $plugin) {
if ($module == 'addressfield') {
return 'plugins/addressfield/' . $plugin;
@bleeDev
bleeDev / gist:6982685
Last active December 25, 2015 13:19
Drupal 7 Database API example
$result = db_query(SELECT a.field_1, b.field_2 as second_field, CONCAT('My', 'S', 'QL') as mysql FROM table_1 a LEFT OUTER JOIN table_2 b ON b.id = a.id WHERE a.field_3 >= 25 and a.field_4 = 'this' ORDER BY a.field_5 DESC);
// Would be equivalent to.
$query = db_select('table_1', 'a');
$query->fields('a', array('field_1'))
->addExpression("CONCAT('My', 'S', 'QL')", 'mysql')
->leftjoin('table_2', 'b', 'b.id = a.id')
->addField('b', 'field_2', 'second_field')
@bleeDev
bleeDev / gist:5259062
Last active December 15, 2015 12:19
Example of filtering an array with a closure
<?php
//Since PHP 5.3: http://www.php.net/manual/en/functions.anonymous.php
$array_to_be_filtered = array(
1 => 'apple',
2 => 'orange',
3 => 'pinapple',
4 => 'plum',
5 => 'tangelo',
6 => 'plum'