Skip to content

Instantly share code, notes, and snippets.


Sam samnajian

View GitHub Profile
samnajian / change-svg-fill-color.js
Created Sep 27, 2017
Trick to change svg fill color
View change-svg-fill-color.js
document.addEventListener('DOMContentLoaded', function() {
* Refrence to object element that has svg as data attribute
const obj = document.querySelector('object');
const svg = obj.contentDocument.querySelector("svg"); = "red" // change fill color to red
}, false);
samnajian / flatten_array.js
Last active Jul 18, 2016
Flattern array in JS
View flatten_array.js
function flatten_array( arr ){
* Checks if _arr is an array
* @param Array|Mixed _arr variable to check
* @return Bool whether _arr is an array
const is_array = ( _arr ) => {
return typeof _arr === "object" && typeof _arr.concat === "function";
samnajian / 0_reuse_code.js
Created Dec 18, 2013
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
samnajian /
Created Dec 18, 2013 — forked from jookyboi/
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.


  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
samnajian /
Created Dec 18, 2013 — forked from jookyboi/
CSS libraries and guides to bring some order to the chaos.


  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.


View gist:58f15655d35c4cdb51ec
'post_image_variants' => '[{\"vid\":\"variant-1415709668089-1002\",\"label\":\"Full Center\",\"group\":{\"margin_left\":\"0\",\"margin_right\":\"0\",\"col\":\"18\",\"row\":\"54\",\"left\":\"0\",\"float\":\"none\",\"height\":\"270\",\"width_cls\":\"c18\",\"left_cls\":\"ml0\",\"clear_cls\":\"\"},\"image\":{\"order\":\"0\",\"col\":\"24\",\"top\":\"0\",\"left\":\"0\",\"row\":\"40\",\"clear\":\"true\",\"height\":\"200\",\"width_cls\":\"c24\",\"left_cls\":\"ml0\",\"clear_cls\":\"clr\",\"top_cls\":\"mt0\"},\"caption\":{\"show\":\"1\",\"order\":\"1\",\"col\":\"24\",\"top\":\"0\",\"left\":\"0\",\"row\":\"10\",\"clear\":\"true\",\"height\":\"50\",\"width_cls\":\"c24\",\"left_cls\":\"ml0\",\"clear_cls\":\"clr\",\"top_cls\":\"mt0\"}},{\"vid\":\"variant-1415709681741-1955\",\"label\":\"Full Left\",\"group\":{\"margin_left\":\"-3\",\"margin_right\":\"0\",\"col\":\"18\",\"row\":\"54\",\"left\":\"0\",\"float\":\"none\",\"height\":\"270\",\"width_cls\":\"c21\",\"left_cls\":\"ml0\",\"clear_cls\":\"\"},\"image\":{\"order\":\"0
View gist:ab7123225f081323b935
/*global ugalleries */
/* @ TODO: need to add [+] button and make sure it triggers the appropriate event..
//Adding [+] control
var $upfrontObjectContent = this.$el.find('.upfront-object-content');
if(this.$el.find('a.add-gallery-item').length < 1) {
$('<b class="upfront-entity_meta add_item upfront-ui"><a href="#" class="upfront-icon-button a.add-gallery-item add-item"></a></b>').insertBefore($upfrontObjectContent);
View gist:32c5299348014c590977
$header = upfront_create_region(
"name" => "header",
"title" => "Header",
"type" => "wide",
"scope" => "local",
"position" => 1,
"allow_sidebar" => true
View gist:efdf26d0153ab63982ed
$header = upfront_create_region(
"name" => "header",
"title" => "Header",
"type" => "wide",
"scope" => "local"
"row" => 24,
View gist:54264acf37a12855ad8e
<?php $typography = '{}';
$layout_style = '#usearch #usearch-archive-search .upfront-object-content{
You can’t perform that action at this time.