Skip to content

Instantly share code, notes, and snippets.

View wayanjimmy's full-sized avatar
🏠
Working from home

Wayan jimmy wayanjimmy

🏠
Working from home
View GitHub Profile
@andyg5000
andyg5000 / Update product stock from order history
Last active December 26, 2015 13:29
Entity Field Query and Entity Metadata Wrapper example: Updates the stock field on products from orders with a past a defined order id (in pending status). I had to write this because the stock rules became corrupt after a series of updates to the site.
<?php
$order_id = 10;
// Create the entity field query object.
$efq = new EntityFieldQuery();
// Add the required filters to the query and execute it.
$result = $efq->entityCondition('entity_type', 'commerce_order')
->propertyCondition('order_id', $order_id, '>=')
->propertyCondition('status', 'pending')
@artem-zinnatullin
artem-zinnatullin / MyApp.java
Last active January 15, 2023 13:04
If you need to set one font for all TextViews in android application you can use this solution. It will override ALL TextView's typefaces, includes action bar and other standard components, but EditText's password font won't be overriden.
public class MyApp extends Application {
@Override
public void onCreate() {
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/Roboto-Regular.ttf"); // font from assets: "assets/fonts/Roboto-Regular.ttf
}
}
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@wbroek
wbroek / genymotionwithplay.txt
Last active February 13, 2025 09:37
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
function contentData(){ // datatables processing
/* Array of database columns which should be read and sent back to DataTables. Use a space where
* you want to insert a non-database field (for example a counter or static image)
*/
$aColumns = array("'no'","data_tabel.id_konten","data_tabel.nama_kat","data_tabel.nama_konten","data_tabel.status_posting","'option'" );
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "data_tabel.id_konten";
/* DB table to use */
$aTable = array( "(SELECT a.id_konten, a.nama_konten, b.nama_kat, a.status_posting FROM tb_konten a
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active April 21, 2025 10:43
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@staltz
staltz / introrx.md
Last active May 6, 2025 07:45
The introduction to Reactive Programming you've been missing
@ricardo-rossi
ricardo-rossi / ElasticSearch.sh
Last active February 25, 2025 22:09
Installing ElasticSearch on Ubuntu 14.04
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red_50">#fde0dc</color>
<color name="red_100">#f9bdbb</color>
<color name="red_200">#f69988</color>
<color name="red_300">#f36c60</color>
<color name="red_400">#e84e40</color>
<color name="red_500">#e51c23</color>
<color name="red_600">#dd191d</color>
<color name="red_700">#d01716</color>
@wayanjimmy
wayanjimmy / contoh_upload_file_laravel.php
Created October 23, 2014 07:08
Contoh Upload File di Laravel
public function uploadLogo() {
$file = Input::file('logo');
$destinationPath = Lingkungan::$logoPath;
$filename = $file->getClientOriginalName();
$img = Image::make($file->getRealPath())->resize(150, 150)->save(public_path().$destinationPath.$filename);
if($img) {
return Response::json(['type' => 'success', 'full_filename' => asset($destinationPath.$filename), 'filename' => $filename]);
}else{