Skip to content

Instantly share code, notes, and snippets.

View reuf's full-sized avatar

Muhamed Halilovic reuf

View GitHub Profile
@reuf
reuf / django-ajax.html
Created September 30, 2015 09:37 — forked from Djiit/django-ajax.html
django-ajax
<polymer-element name="django-ajax" extends="core-ajax">
<script>
Polymer({
getCSRFCookie: function() {
b = document.cookie.match('(^|;)\\s*csrftoken\\s*=\\s*([^;]+)');
return b ? b.pop() : '';
},
ready: function() {
this.super();
this.headers = {
@reuf
reuf / RBTree
Created September 30, 2015 10:09 — forked from adderllyer/RBTree
red-black tree implementation
package com.ds.tree.rbtree;
import java.util.LinkedList;
import java.util.Queue;
import com.ds.tree.adt.BinarySearchTree;
import com.ds.tree.adt.TreeTraversal;
/**
@reuf
reuf / struktura_stranice.txt
Created September 30, 2015 10:10
StrutkuraStranice
Lekcija
- id
- naslov,
- redni broj,
- opis
Tekst
- id_vjezbe
- id_rijecnika
- id_
@reuf
reuf / read_write.pl
Created September 30, 2015 10:11 — forked from seouri/read_write.pl
read/write perl
sub read_file {
my $file_name = shift;
print STDERR "READ $file_name ... ";
my @file;
open(FH, "< $file_name") or die("Can't read $file_name: $!\n");
while (<FH>) {
chomp;
my @t = split /\t/;
@t = map { s/^\s+//g; s/\s+$//g; $_ } @t;
push @file, \@t;
@reuf
reuf / ActionSupportParamDemo.page
Created December 20, 2015 23:09 — forked from martyychang/ActionSupportParamDemo.page
Demonstration of how apex:actionSupport and apex:param are supposed to work together
<apex:page controller="ActionSupportParamDemoController">
<apex:form>
<apex:repeat value="{!accounts}" var="account">
<apex:inputCheckbox value="{!account.IsActive__c}">
<apex:actionSupport event="onchange"
action="{!handleAccountCheckboxChange}">
<apex:param id="account" name="accountId" value="{!account.Id}"
assignTo="{!targetAccountId}"/>
</apex:actionSupport>
</apex:inputCheckbox>
@reuf
reuf / HiddenInputSupportDemo.page
Created December 20, 2015 23:09 — forked from martyychang/HiddenInputSupportDemo.page
Demonstration of using an apex:actionSupport with a "hidden" input
<apex:page standardController="Account">
<h2>Form</h2>
<apex:form>
<apex:inputText id="accountNameInput" styleClass="with-hidden"/>
<apex:inputText id="accountNameInputHidden"
value="{!Account.Name}"
style="display:none">
<apex:actionSupport event="onchange" action="{!quicksave}"
reRender="accountNameOutput"
status="accountNameStatus"/>
@reuf
reuf / SetNewOwner.trigger
Created December 20, 2015 23:09 — forked from martyychang/SetNewOwner.trigger
Trigger to enable users to change the Case Owner through a proxy field via a publisher action in Salesforce1
trigger SetNewOwner on Case (before insert, before update) {
for (Case eachCase : Trigger.new) {
if (eachCase.NewOwner__c != null) {
eachCase.OwnerId = eachCase.NewOwner__c;
eachCase.NewOwner__c = null;
}
}
}
@reuf
reuf / PieChartRemoteDemo.page
Created December 20, 2015 23:09 — forked from martyychang/PieChartRemoteDemo.page
How to move JavaScript functions out of the global namespace when used with Visualforce chart components
<apex:page controller="PieChartRemoteController">
<script>
var noData = new Object(); // Simply a dummy placeholder for data attribute
var App = App || {}; // To hold functions
App.retrieveChartData = function(callback) {
var year = document.getElementById('theYear').value;
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.PieChartRemoteController.getRemotePieData}',
year,
@reuf
reuf / BatchableExperiment.cls
Created December 20, 2015 23:10 — forked from martyychang/BatchableExperiment.cls
Apex class that illustrates how a completely self-contained Batchable actually works
/*
* Database.Batchable that can be executed, assuming you have a custom object
* named Experiment__c that already exists in your org, with a custom
* Text field named Title__c
*/
global class BatchableExperiment
implements Database.Batchable<Task>, Iterable<Task>, Iterator<Task> {
/*
* The ID of the Experiment record created for this batch job
@reuf
reuf / NullSObjectPropertyBugDemoController.cls
Created December 20, 2015 23:10 — forked from martyychang/NullSObjectPropertyBugDemoController.cls
It appears that instead of setting a null property to null when returning an sObject via Apex, the property simply isn't set at all and creates odd problems in the UI
public class NullSObjectPropertyBugDemoController {
@AuraEnabled
public static Id editLead(Lead newLead) {
Id newLeadId = null;
try {
upsert newLead;
newLeadId = newLead.Id;
}