Skip to content

Instantly share code, notes, and snippets.

<link rel="import" href="../notification-elements/notification-alert.html">
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../paper-toast/paper-toast.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../core-animated-pages/core-animated-pages.html">
<link rel="import" href="../core-animated-pages/transitions/hero-transition.html">
<link rel="import" href="../core-animated-pages/transitions/cross-fade.html">
<link rel="import" href="../core-animated-pages/transitions/slide-down.html">
<link rel="import" href="../core-animated-pages/transitions/slide-up.html">
<link rel="import" href="../core-animated-pages/transitions/tile-cascade.html">
@ferlyz05
ferlyz05 / How to embed Javascript widget
Last active June 21, 2022 14:33
How to embed Javascript widget
(function(window, document, version, callback) {
var j, d;
var loaded = false;
if (!(j = window.jQuery) || version > j.fn.jquery || callback(j, loaded)) {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "/media/jquery.js";
script.onload = script.onreadystatechange = function() {
if (!loaded && (!(d = this.readyState) || d == "loaded" || d == "complete")) {
callback((j = window.jQuery).noConflict(1), loaded = true);
'afterAjaxUpdate'=>"function(){jQuery('#Presensi_waktu').datepicker({'showAnim':'fold','showOn':'focus','dateFormat':'dd-mm-yy','changeMonth':'true','changeYear':'true'})}",
array(
'name'=>'tanggal',
'value'=>'$data->tanggal."-".$data->bulan."-".$data->tahun',
'filter'=>$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name'=>'Presensi[waktu]',
'options'=>array(
'showAnim'=>'fold', // 'show' (the default), 'slideDown', 'fadeIn', 'fold'
var letters = [];
var rword = "";
putstr("Enter a sentence: ");
var sentence = readline();
var sword = "";
for (var i = 0; i < sentence.length; i++) {
if (sentence[i] == " ") {
;
}
Note that the code snippets in this article have been tested in the latest Google Chrome version 30, which uses the V8 JavaScript Engine (V8 3.20.17.15).
1 – Don’t forget var keyword when assigning a variable’s value for the first time.
Assignment to an undeclared variable automatically results in a global variable being created. Avoid global variables.
2 – use === instead of ==
The == (or !=) operator performs an automatic type conversion if needed. The === (or !==) operator will not perform any conversion. It compares the value and the type, which could be considered faster than ==.
The template:
<img class="placeholder" src="avatar-small.jpg" width="200" height="200">
<img class="fullImage" src="avatar-large.jpg" width="200" height="200">
The CSS:
.fullImage {
transition: opacity 0.2s linear;
}
the javascript:
/* $sql = 'SELECT *
FROM pelanggan, (
SELECT id_pelanggan, COUNT( id ) AS total_promo, SUM( jumlah_resi ) AS jumlah_resi, SUM( total_nominal ) AS total_transaksi
FROM `promo`
GROUP BY id_pelanggan
) AS x
WHERE id = x.id_pelanggan'; */
$criteria = new CDbCriteria();
$criteria->compare('customer.nama',$this->nama,true);
Edit index-test.php:
$boot=dirname(__FILE__).'/protected/tests/bootstrap.php';
require_once($boot);
- Run CMD as Administrator
- cd C:\xampp\htdocs\contest2\protected\tests
- pear config-set auto_discover 1
- pear install pear.symfony.com/Yaml
- pear install --alldeps pear.phpunit.de/PHPUnit
- pear install Testing_Selenium-beta
function shorten_string($string, $wordsreturned)
/* Returns the first $wordsreturned out of $string. If string
contains fewer words than $wordsreturned, the entire string
is returned.
*/
{
$retval = $string; // Just in case of a problem
$array = explode(" ", $string);
if (count($array)<=$wordsreturned)
Dim s As String = ""
Dim bound0 As Integer = penampunganNilaiHujan.GetUpperBound(0)
Dim bound1 As Integer = penampunganNilaiHujan.GetUpperBound(1)
' Loop over all elements.
For i As Integer = 0 To bound0
For x As Integer = 0 To bound1
' Get element.
Dim s1 As String = penampunganNilaiHujan(i, x)