Skip to content

Instantly share code, notes, and snippets.

@muzfr7
muzfr7 / Timestampable.php
Last active February 8, 2024 09:14
Timestampable Trait for doctrine entities to use in order to not to repeat them in individual entities.
<?php
namespace AppBundle\Entity\Traits;
use Doctrine\ORM\Mapping as ORM;
/**
* Adds created at and updated at timestamps to entities.
* Entities using this must have HasLifecycleCallbacks annotation.
*
@LogansUA
LogansUA / robomongo_desktop_entry.md
Last active February 16, 2022 05:41
Example of desktop entry on Ubuntu system for Robomongo

Creating desktop entry

$ touch /usr/share/applications/robomongo.desktop

Edit

$ vim /usr/share/applications/robomongo.desktop
@jorupp
jorupp / gist:2af4d8583bd592b8331f
Created March 4, 2015 15:43
Lock all media queries in their current state
function process(rule) {
if(rule.cssRules) {
for(var i=rule.cssRules.length-1; i>=0; i--) {
process(rule.cssRules[i]);
}
}
if(rule.type == CSSRule.MEDIA_RULE) {
if(window.matchMedia(rule.media.mediaText).matches) {
rule.media.mediaText = "all";
} else {
@elidickinson
elidickinson / html_email_buttons_1.html
Last active November 27, 2023 14:55
HTML email buttons that work
<div>
<!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="http://www.EXAMPLE.com/" style="height:40px;v-text-anchor:middle;width:300px;" arcsize="10%" stroke="f" fillcolor="#d62828">
<w:anchorlock/>
<center style="color:#ffffff;font-family:sans-serif;font-size:16px;font-weight:bold;">
Button Text Here!
</center>
</v:roundrect>
<![endif]-->
<![if !mso]>
@isimmons
isimmons / gist:8202227
Last active March 15, 2024 10:47
Truncate tables with foreign key constraints in a Laravel seed file.

For the scenario, imagine posts has a foreign key user_id referencing users.id

public function up()
{
	Schema::create('posts', function(Blueprint $table) {
		$table->increments('id');
		$table->string('title');
		$table->text('body');
@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active November 29, 2023 15:35
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var assert = require('assert')
console.log('\n===========');
console.log(' mongoose version: %s', mongoose.version);
console.log('========\n\n');
var dbname = 'testing_geojsonPoint';
@millermedeiros
millermedeiros / example.js
Last active September 10, 2022 03:06
execute multiple shell commands in series on node.js
// USAGE ------
// ============
var shell = require('./shellHelper');
// execute a single shell command
shell.exec('npm test --coverage', function(err){
console.log('executed test');
}});