Skip to content

Instantly share code, notes, and snippets.

View JayKandari's full-sized avatar
:octocat:

Jaideep Singh Kandari JayKandari

:octocat:
View GitHub Profile
@MahinAbbasianpoor
MahinAbbasianpoor / repeat_watermark_imagick.php
Last active May 25, 2020 22:04
repeat watermark image with imagick in php
// load images
$image = new Imagick("main_image.jpg");
$watermark = new Imagick("stamp.png");
// main image dimension
$geo=$image->getImageGeometry();
$x=$geo['width'];
$y=$geo['height'];
// stamp image dimension
@crittermike
crittermike / gist:7b654d3d686a4e434eda
Created March 26, 2015 00:56
Run a single specific Drupal update hook using Drush
drush php-eval "module_load_install('MYMODULE'); MYMODULE_update_NUMBER();"
@brainwipe
brainwipe / snap.svg.text.in.a.box.html
Last active May 27, 2022 00:03
Using Snap.svg to create a box with text in it. The bounding "container" box expands to fit the width of the text.
<html>
<head>
<script src="//cdn.jsdelivr.net/snap.svg/0.1.0/snap.svg-min.js"></script>
<script>
var s = Snap("#svg");
var block = s.rect(50, 50, 100, 100, 20, 20);
block.attr({
fill: "rgb(236, 240, 241)",
stroke: "#1f2c39",
@brainwipe
brainwipe / snap.svg.snapping.html
Created November 27, 2013 10:38
Using Snap.svg to create a draggable box that snaps to grid.
<!DOCTYPE html>
<html>
<head>
<script src="//cdn.jsdelivr.net/snap.svg/0.1.0/snap.svg-min.js"></script>
<script>
var s = Snap("#svg");
var gridSize = 50;
var orig = {
x: 0,
y: 0
@clops
clops / JavaScriptGames.txt
Last active January 25, 2021 20:26
Crazy! Collection of JavaScript games made in under 35 lines of code
36 Line Tetris --> http://jsfiddle.net/ova777/kFxja/
30 Line Sokoban --> http://jsfiddle.net/zabbius/nU74f/
34 Line Minesweeper --> http://jsfiddle.net/c884a/
30 Line Arcanoid --> http://jsfiddle.net/martin_/Fq8F4/
30 Line Snake --> http://jsfiddle.net/Uk2PP/9/
30 Line Excel --> http://jsfiddle.net/zag2art/b3pbw/4/
30 Line Race --> http://jsfiddle.net/Minimajack/C545E/embedded/result/
37 Line PONG --> http://jsfiddle.net/WNrfp/6/
@mhemesath
mhemesath / transformToMatrix.js
Created October 9, 2012 03:01
Converts a SVG transform string into a Raphael Matrix object.
function toMatrix(transform) {
var transforms = transform.split(' '),
matrix = Raphael.matrix();
for (var i=0; i<transforms.length; i++) {
var match = /^(\w+)\((.+)\)$/.exec(transforms[i]),
tranform = match[1],
values = toFloatArray(match[2]);
if ('translate' === transform) matrix.translate.apply(matrix, values);