Skip to content

Instantly share code, notes, and snippets.

Magento Snippets

Set all categories to is_anchor 1

Find attribute_id

SELECT * FROM eav_attribute where attribute_code = 'is_anchor'

Update all of them with anchor_id from above (usually is ID 51)

UPDATE `catalog_category_entity_int` set value = 1 where attribute_id = 51
float theta_scale = 0.1; //Set lower to add more points
int size = (2.0 * PI) / theta_scale; //Total number of points in circle.
LineRenderer lineRenderer = gameObject.AddComponent<LineRenderer>();
lineRenderer.material = new Material(Shader.Find("Particles/Additive"));
lineRenderer.SetColors(c1, c2);
lineRenderer.SetWidth(0.2F, 0.2F);
lineRenderer.SetVertexCount(size);
int i = 0;
using UnityEngine;
public class Follow : MonoBehaviour {
Transform target; //the target to follow
Vector3 offset = Vector3.zero; //the amount to be offset by 
void Update() {
if(target) transform.position = target.position + offset;
}
}
using UnityEngine;using System.Collections;  public class Attackable : MonoBehaviour { public float maxHp; public float currentHp; public Camera mainCamera; public Texture2D hpBarBG; public Texture2D hpBarCurrent;  private float offsetY;  //script will be atached to each GameObject that can suffer dmg. void Start () { //put it on top of the character offsetY=gameObject.collider.bounds.size.y+5; Debug.Log(offsetY); }  void Update () { }  void OnGUI(){ //the hp bar background location on screen Rect rcBg = new Rect(0,0,60,14); //the current HP bar Rect rcCurrent = new Rect(0,0,((currentHp)/maxHp)*56,8);  //the important part : where this object is located in my screen Vector3 point = mainCamera.WorldToScreenPoint(new Vector3( transform.position.x,
@abdullah353
abdullah353 / curl_replicate.sh
Created September 7, 2014 17:07
Couchdb Replicate Design Document Only by using curl
curl -X POST -H "Content-Type:application/json" -d '{"target":"http://youruser:yourpassword@yourserver/tangerine","source":"http://youruser:yourpassword@yourserver/tangerine","doc_ids": ["_design/tangerine"]}' http://youruser:yourpassword@yourserver/_replicate
#!/usr/bin/php
<?php
class AsyncOperation extends Thread {
public function __construct($arg) {
$this->arg = $arg;
}
public function run() {
if ($this->arg) {
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
<?php
Illuminate\Routing\UrlGenerator
__construct(RouteCollection $routes, Request $request) Both parameter ar from Symfony
full() // Get the full URL for the current request.
current() // Get the current URL for the request.
previous() // Get the URL for the previous request.
to($path, $parameters = array(), $secure = null) // Generate a absolute URL to the given path.
secure($path, $parameters = array()) // Generate a secure, absolute URL to the given path.
asset($path, $secure = null) // Generate a URL to an application asset.
Form::file('file[]', array('multiple'=>true));
//or:
<input multiple="1" name="file[]" type="file">
//Or for older browsers:
<input name="file[]" type="file">
<input name="file[]" type="file">
<input name="file[]" type="file">
import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_highgui.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;
public class circleDetection{
public static void main(String[] args){
IplImage src = cvLoadImage("img2.png");
IplImage gray = cvCreateImage(cvGetSize(src), 8, 1);
cvCvtColor(src, gray, CV_BGR2GRAY);