Skip to content

Instantly share code, notes, and snippets.

View jklance's full-sized avatar

Jer Lance jklance

View GitHub Profile
@jklance
jklance / keybase.md
Created September 21, 2016 19:58
Verifying my identity on keybase.io

Keybase proof

I hereby claim:

  • I am jklance on github.
  • I am jer_ (https://keybase.io/jer_) on keybase.
  • I have a public key whose fingerprint is AE48 4DC3 7A58 DCA8 FBBB A5AC D314 606C 136E F6E0

To claim this, I am signing this object:

@jklance
jklance / magento_cms_block.php
Created May 22, 2015 14:38
Magento - Create a CMS block in an upgrade script
$content = 'BLOCK CONTENT HERE';
//if you want one block for each store view, get the store collection
$stores = Mage::getModel('core/store')->getCollection()->addFieldToFilter('store_id', array('gt'=>0))->getAllIds();
//if you want one general block for all the store viwes, uncomment the line below
//$stores = array(0);
foreach ($stores as $store){
$block = Mage::getModel('cms/block');
$block->setTitle('Block title here');
$block->setIdentifier('block_identifier_here');
$block->setStores(array($store));
@jklance
jklance / add_admin_user.sql
Last active August 20, 2016 13:23
Magento add admin user
LOCK TABLES
`admin_role` WRITE,
`admin_user` WRITE;
SET @SALT = "salt";
SET @PASS = CONCAT(MD5(CONCAT( @SALT , "password") ), CONCAT(":", @SALT ));
SELECT
@EXTRA := MAX(extra)
FROM
@jklance
jklance / magento_removeAllCategories.sql
Created March 20, 2014 14:01
Magento: Remove all categories from a store
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `catalog_category_entity`;
TRUNCATE TABLE `catalog_category_entity_datetime`;
TRUNCATE TABLE `catalog_category_entity_decimal`;
TRUNCATE TABLE `catalog_category_entity_int`;
TRUNCATE TABLE `catalog_category_entity_text`;
TRUNCATE TABLE `catalog_category_entity_varchar`;
TRUNCATE TABLE `catalog_category_product`;
TRUNCATE TABLE `catalog_category_product_index`;
@jklance
jklance / add_osx_dock_spacer.sh
Created November 11, 2013 17:53
Add a spacer to the OSX dock
defaults write com.apple.dock persistent-apps -array-add '{\"tile-type\"=\"spacer-tile\";}'
@jklance
jklance / compile_opengl.sh
Created November 11, 2013 17:52
Compile an OpenGL program on OSX
gcc -o compiled_file.exe compiled_file.cpp -framework Carbon -framework OpenGL -framework GLUT ;
@jklance
jklance / HTML_checkbox_limiter.js
Created December 6, 2012 00:58
Limit HTML checkbox selections
<script type="text/javascript">
// Limit the number of checkboxes that can be selected at one time
var checkboxLimit = 3;
var questionTolimit = 'q3';
$("input[type=checkbox][name="+questionTolimit+"]").click(function() {
var checkTest = $("input[type=checkbox][name="+questionTolimit+"]:checked").length >= checkboxLimit;
$("input[type=checkbox][name="+questionTolimit+"]").not(":checked").attr("disabled",checkTest);
});
</script>